%let nobs=5;
data test ;call streaminit(0);do i= 1 to &nobs; u=rand("uniform"); max=10; x=ceil(max*u);output;end;keep x;run;
proc transpose data=test out=ly;var x;run;
data ly_2;set ly(keep=col1-col5);rename col1=a col2=b col3=c col4=d col5=e;run;
data jg;set ly_2;s1=a+b+c;s2=a+b+d;s3=a+b+e;s4=a+c+d;s5=a+c+e;S6=a+d+e;s7=b+C+D;S8=B+C+E;S9=B+D+E;S10=C+D+E;run;
data jg_1;set jg;
if s1 lt 10 then ; else do; w1=mod (s1,10); if w1 eq 0 then R1=1; else R1=0; end;
if s2 lt 10 then ; else do; w2=mod (s2,10); if w2 eq 0 then R2=1; else R2=0; end;
if s3 lt 10 then ; else do; w3=mod (s3,10); if w3 eq 0 then R3=1; else R3=0; end;
if s4 lt 10 then ; else do; w4=mod (s4,10); if w4 eq 0 then R4=1; else R4=0; end;
if s5 lt 10 then ; else do; w5=mod (s5,10); if w5 eq 0 then R5=1; else R5=0; end;
if s6 lt 10 then ; else do; w6=mod (s6,10); if w6 eq 0 then R6=1; else R6=0; end;
if s7 lt 10 then ; else do; w7=mod (s7,10); if w7 eq 0 then R7=1; else R7=0; end;
if s8 lt 10 then ; else do; w8=mod (s8,10); if w8 eq 0 then R8=1; else R8=0; end;
if s9 lt 10 then ; else do; w9=mod (s9,10); if w9 eq 0 then R9=1; else R9=0; end;
if s10 lt 10 then ; else do; w10=mod (s10,10); if w10 eq 0 then R10=1; else R10=0; end;
run;
data jg_2;set jg_1;if R1=1 or R2=1 or R3=1 or R4=1 or R5=1 or R6=1 or R7=1 or R8=1 or R9=1 or R10 then zz='有牛';else zz='无牛';run;
data jg_3;set jg_2;
if r1=1 then do; n1=d+e; if n1 le 10 then yu=n1; else yu=n1-10; end;if r2=1 then do; n2=c+e; if n2 le 10 then yu=n2; else yu=n2-10; end;
if r3=1 then do; n3=d+c; if n3 le 10 then yu=n3; else yu=n3-10; end;if r4=1 then do; n4=b+e; if n4 le 10 then yu=n4; else yu=n4-10; end;
if r5=1 then do; n5=d+b; if n5 le 10 then yu=n5; else yu=n5-10; end;if r6=1 then do; n6=c+b; if n6 le 10 then yu=n6; else yu=n6-10; end;
if r7=1 then do; n7=a+e; if n7 le 10 then yu=n7; else yu=n7-10; end;if r8=1 then do; n8=d+a; if n8 le 10 then yu=n8; else yu=n8-10; end;
if r9=1 then do; n9=a+c; if n9 le 10 then yu=n9; else yu=n9-10; end;if r10=1 then do; n10=a+b; if n10 le 10 then yu=n10; else yu=n10-10; end;
wcyn=put (yu,2.);
if zz='有牛' then hh=cats ('牛',wcyn); else hh='无牛,煞笔!';
if a=10 and b=10 and c=10 and d=10 and e=10 then hh='恭喜!!!五花牛!';
if a le 5 and b le 5 and c le 5 and d le 5 and e le 5 then hh='恭喜!!!五小牛!';
keep hh;run;
proc print data=jg_3 obs;run;
完全可以再优化的,没有时间了 在写炸金花5人场的sas了