Examples (SAMPLE command)

Sampling an Approximate Percentage of Cases

SAMPLE .25.
  • This command samples approximately 25% of the cases in the active dataset.

Sampling a Specific Number of Cases

SAMPLE 500 FROM 3420.
  • The active dataset must have 3420 or more cases to obtain a random sample of exactly 500 cases.
  • If the file contains fewer than 3420 cases, proportionally fewer cases are sampled.
  • If the file contains more than 3420 cases, a random sample of 500 cases is drawn from the first 3420 cases.

Sampling Subgroups

DO IF  SEX EQ 'M'.
SAMPLE 1846 FROM 8000.
END IF.
  • SAMPLE is placed inside a DO IF-END IF structure to sample subgroups differently. Assume that this survey is for 10,000 people in which 80% of the sample is male, while the known universe is 48% male. To obtain a sample that corresponds to the known universe and that maximizes the size of the sample, 1846 (48/52*2000) males and all females must be sampled. The DO IF structure restricts the sampling process to the males.