rockfido 发表于 2010-6-17 00:51
请问如果有PROC SURVEYSELECT 的时候,如果不知道SAMPLESIZE,只知道每个GROUP要取出50%的,该如何处理呢?
PROC SURVEYSELECT DATA = A OUT =B SAMPSIZE =???? SEED = 12345;
STRATA CLASS; /*我需要每个CLASS中都取50%的SAMPLE*/
ID _ALL_;
RUN;
非常感谢!!
As long as you know the levels of class variable, you can specify the sample rate as,
SAMPRATE =(0.5 0.5 0.5 0.5 0.5)
in the example below.
data a;
do i = 1 to 500;
class=ceil(ranuni(123)*5);
output;
end;
run;
proc sort data=a; by class; run;
PROC SURVEYSELECT DATA = a OUT =b SAMPRATE =(0.5 0.5 0.5 0.5 0.5) SEED = 12345;
STRATA CLASS;
RUN;
proc print; run;
proc freq data=a;
table class;
run;
proc freq data=b;
table class;
run;