SAS Examples: Survey Select
Last updated:Table of Contents
Sample fixed number of rows
Sample N (N=100) rows from <library>.<input_table>
, save result into <library>.<output_table>
.
proc surveyselect data=<library>.<input_table>
n=100 seed=42 out=<library>.<output_table>;
run;
Sample fraction of rows
Sample N% of the rows from <library>.<input_table>
, save result into <library>.<output_table>
.
rate
ranges from 0 (sample no rows) to 1 (sample all rows)
proc surveyselect data=<library>.<input_table>
rate=0.2 seed=42 out=<library>.<output_table>;
run;
Stratified sampling
Sample (N * the amount of strata) rows from <library>.<input_table>
, save result into <library>.<output_table>
.
It will throw an error if the rarest class for <stratum_column>
has less than N rows.
proc surveyselect data=<library>.<input_table>
n=100 seed=42 out=<library>.<output_table>;
strata <stratum_column>;
run;