%let sample_size=1000 ;
proc plan seed=27371 ;
factors sex=&sample_size. /noprint;
output out=sex ;
factors age=&sample_size. /noprint;
output out=age ;
factors Region=&sample_size. /noprint;
output out=Region ;
quit;
data temp;
merge sex age region;
run;
proc rank data=temp out=temp2 groups=100 ;
var sex age region;
ranks r_sex r_age r_region;
run;
data want;
set temp2;
char_sex=ifc(r_sex in (0:29),'Male ','Female');
char_age=ifc(r_age in (0:39),'Age>=65 ','Age <65');
select;
when(r_region in (0:9)) char_Region='West ';
when(r_region in (10:29)) char_Region='Northeast';
when(r_region in (30:69)) char_Region='Southwest';
when(r_region in (70:94)) char_Region='Midwest ';
when(r_region in (95:99)) char_Region='Southeast ';
otherwise;
end;
keep char_:;
run;
proc freq data=want;
table char_:;
run;
... View more