我有一个笨方法:
data a (keep=d1-d3);
array hm[9] (1 2 3 4 5 6 7 8 9);
do a=1 to 2; /*从A类样本中抽取1个到2个 */
do b=1 to 2; /*从B类样本中抽取1个到2个 */
do c=0 to 1; /*从C类样本中抽取0个到1个 */
if a=1 and b=1 and c=1 then /*当抽取组合是111时*/
do a111=1 to 4;
d1=hm{a111};
do b111=5 to 7;
d2=hm{b111};
do c111=8 to 9;
d3=hm{c111};
output;
end; end; end;
if a=1 and b=2 and c=0 then /*当抽取组合是120时*/
do a120=1 to 4;
d1=hm{a120};
do b120=5 to 7;
d2=hm{b120};
do c120=b120+1 to 7;
d3=hm{c120};
output;
end; end; end;
if a=2 and b=1 and c=0 then /*当抽取组合是210时*/
do a210=1 to 4;
d1=hm{a210};
do b210=a210+1 to 4;
d2=hm{b210};
do c210=5 to 7;
d3=hm{c210};
output;
end; end; end;