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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
DATA test;
input col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15;
cards;
1 10 1 1 1 1 1 1 1 1 1 1 1 1 1
1 10 1 1 2 2 2 2 2 2 2 2 2 2 2
1 10 1 1 3 3 3 3 3 3 3 3 3 3 3
1 10 1 1 4 4 4 4 4 4 4 4 4 4 4
1 10 1 1 1 1 1 1 1 1 1 1 1 1 1
1 10 1 1 2 2 2 2 2 2 2 2 2 2 2
1 10 1 1 3 3 3 3 3 3 3 3 3 3 3
; run ;
%macro test();
%global variable;
%let variable= ;
proc contents data=test out=contenu(keep=name ) noprint;
run;
data _null_;
set contenu;
call symputx('var'||left(_n_),compress(name));
call symput('cnt',compress(_n_));
run;
%do i=1 %to &cnt;
proc sort data=test nodupkey out=test_nodup;
by &&var&i ;
run;
DATA _null_;
SET test_nodup END=eof;
IF eof THEN DO;
CALL SYMPUT('nb',put(_N_,8.));
END;
run;
%if &nb =1 %then %do;
%let variable=%sysfunc(catx(%str( ),&variable,&&var&i));
%put &variable;
%end;
%end;
%mend;
%test;
data test (drop=&variable );
set test;
run; |
Partager