1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| data table1 table2 ;
x="class3" ; y=2 ; output table1 ;
x="class1" ; y=5 ; output table1 ;
x="class2" ; y=7 ; output table1 ;
x="class3" ; y=3 ; output table2 ;
x="class1" ; y=2 ; output table2 ;
x="class2" ; y=1 ; output table2 ;
run ;
DATA TABLES ;
input num_table $20. ;
datalines ;
table1
table2
;
run ;
%macro tables() ;
data _null_ ;
set tables end=fin ;
call symput(compress("table" || _N_), num_table) ;
call symput(compress("table_result" || _N_), compress(num_table || "_result")) ;
if fin then call symput ('n', _N_) ;
run ;
%do i=1 %to &n. ;
%put &&table&i.. ;
proc sort DATA=&&table&i.. out=&&table_result&i.. ;
by x ;
run ;
%end ;
%mend ;
%tables ; |
Partager