PROC GLOBAL
numeric samplePercentage = 5;
numeric caseCount = 0;
PROC CREATESAMPLE_QUEST
preproc
inc(caseCount);
if caseCount = ( 100 / samplePercentage ) then
caseCount = 0;
else
skip case;
endif;
Alternatively, you can use the random function to generate a sample file that does not choose every nth case. Remember to call the seed function before using the random function.numeric samplePercentage = 5;
numeric caseCount = 0;
PROC CREATESAMPLE_QUEST
preproc
inc(caseCount);
if caseCount = ( 100 / samplePercentage ) then
caseCount = 0;
else
skip case;
endif;
if random(1,100 / samplePercentage) <> 1 then
skip case;
endif;
skip case;
endif;