I would appreciate if some colleague could tell me if following code is correct. This is an example of using proc survey select with N= 100 individuals for assigning 2 treatments (A and B) but with 2 strata, with 2 levels in stratum1 (a=48% and b=52%) and 2 levels in stratum2 (x=75% and y=25%): * I create the sample of N=100 with the 2 strata with different proportions of levels; data A; do n=1 to 100; if n<=48 then stratum1='a'; else stratum1='b'; if (1 le n le 36) or (50 le n le 88) then stratum2='x'; else stratum2='y'; output; end; run; proc sort data=A; by stratum1 stratum2; run; * In data set B we would have treatment B and the rest of patients in data set A would be given treatment A; proc surveyselect data=A method=srs rate=(0.48 0.52) out=B; strata stratum1; run; * Merging the 2 data sets; proc sort data=A; by n; proc sort data=B; by n; data AB (keep=n stratum1 stratum2 treatment); merge A (in=a1) B (in=b1); by n; treatment='A'; if a1 and b1 then treatment='B'; run; Thank you in advance, Jorge77
... View more