27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SAMPLE 1447<br />

• If SAMPLE precedes SELECT IF, cases are selected from the sample.<br />

• If more than one SAMPLE is specified in a session, each acts upon the sample selected by<br />

the preceding SAMPLE command.<br />

• If N OF CASES is used with SAMPLE, the program reads as many records as required to<br />

build the specified n cases. It makes no difference whether the N OF CASES precedes or<br />

follows the SAMPLE.<br />

Limitations<br />

Example<br />

Example<br />

Example<br />

SAMPLE cannot be placed in a FILE TYPE—END FILE TYPE or INPUT PROGRAM—END INPUT<br />

PROGRAM structure. It can be placed nearly anywhere following these commands in a transformation<br />

program. See Appendix A for a discussion of program states and the placement of<br />

commands.<br />

SAMPLE .25.<br />

• This command samples approximately 25% of the cases in the working data file.<br />

SAMPLE 500 FROM 3420.<br />

• The working data file must have 3420 cases or more to obtain a random sample of exactly<br />

500 cases.<br />

• If the file contains fewer than 3420 cases, proportionally fewer cases are sampled.<br />

• If the file contains more than 3420 cases, a random sample of 500 cases is drawn from the<br />

first 3420 cases.<br />

DO IF SEX EQ ’M’.<br />

SAMPLE 1846 FROM 8000.<br />

END IF.<br />

• SAMPLE is placed inside a DO IF—END IF structure to sample subgroups differently.<br />

Assume that this is a survey of 10,000 people in which 80% of the sample is male, while<br />

the known universe is 48% male. To obtain a sample that corresponds to the known<br />

universe and that maximizes the size of the sample, 1846 (48/52*2000) males and all<br />

females must be sampled. The DO IF structure is used to restrict the sampling process to<br />

the males.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!