SAS: Creating classdata -


i'm trying create classdata proc tabulate command. how can following less code? rather having spell out eventtime , node each of 2 groups, can add text each node, starting l, ll , lw etc?

proc sql; create table foo(prefflag num, eventtime num,node char(100)); quit; proc sql;  insert foo (prefflag, eventtime, node)                                                                                          values (0,1, "") values (0,2, "l") values (0,2, "w") values (0,3, "ll") values (0,3, "lw") values (0,3, "wl") values (0,3, "ww") values (0,4, "lll") values (0,4, "llw") values (0,4, "lwl") values (0,4, "lww") values (0,4, "wll") values (0,4, "wlw") values (0,4, "wwl") values (0,4, "www") values (0,5, "llll") values (0,5, "lllw") values (0,5, "llwl") values (0,5, "llww") values (0,5, "lwll") values (0,5, "lwlw") values (0,5, "lwwl") values (0,5, "lwww") values (0,5, "wlll") values (0,5, "wllw") values (0,5, "wlwl") values (0,5, "wlww") values (0,5, "wwll") values (0,5, "wwlw") values (0,5, "wwwl") values (0,5, "wwww") values (1,1, "") values (1,2, "l") values (1,2, "w") values (1,3, "ll") values (1,3, "lw") values (1,3, "wl") values (1,3, "ww") values (1,4, "lll") values (1,4, "llw") values (1,4, "lwl") values (1,4, "lww") values (1,4, "wll") values (1,4, "wlw") values (1,4, "wwl") values (1,4, "www") values (1,5, "llll") values (1,5, "lllw") values (1,5, "llwl") values (1,5, "llww") values (1,5, "lwll") values (1,5, "lwlw") values (1,5, "lwwl") values (1,5, "lwww") values (1,5, "wlll") values (1,5, "wllw") values (1,5, "wlwl") values (1,5, "wlww") values (1,5, "wwll") values (1,5, "wwlw") values (1,5, "wwwl") values (1,5, "wwww");                                                                                                                                                                                                          quit;  

try using arrays in data step. not less code, less repetitive.

data foo;   format node $4.;   array a[2] $ ('l','w');   array b[4] $ ('ll,','lw',...);   array c[8] $ ('lll',...);   array d[16] $ ('llll',...);    i=0 1;     preflag=i;     eventtime=1; node=''; output;     eventtime=2; j=1 dim(a); node=a[j]; output; end;     eventtime=3; j=1 dim(b); node=b[j]; output; end;     eventtime=4; j=1 dim(c); node=c[j]; output; end;     eventtime=5; j=1 dim(d); node=d[j]; output; end;   end;    drop a1-a2 b1-b4 c1-c8 d1-d16;  run; 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -