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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| %macro test5(fichier,nb_tb);
data donnesN;
set &fichier;
keep _NUMERIC_;
run;
data cara;
set &fichier;
keep _CHARACTER_;
run;
data cara;
set cara;
if data=cara then do;
proc contents data=cara out=Descar;
run;
end;
else do;
proc means data= donnesN n nmiss min Q1 median Q3 max mean std ;
var _ALL_;
output out= work.quanti;
run;
end;
%let i= _N_;
data Descar;
set Descar;
call symput(compress("nomvar"||_N_),NAME);
varId=symget("nomvar"||left(put(_N_,4.)));
/*call symput(compress("var"||_N_),varnum);
vaId=symget("var"||left(put(_N_,4.)));
run;/*;
/*%global num;
data _NULL_;
if 0 then set Descar nobs=NAME;
call symput("num",left(put(NAME)));
stop;
run;/*;
/*%let nomb=_N_;*/;
/*data Des;
set Descar;
call symput(compress("var"||_N_,varnum);
vaId=symget("var"||left(put(_N_,4.)));
run;*/
run;
data Des;
set Descar;
call symput(compress("nomvarr"||_N_),VARNUM);
varId=symget("nomvarr"||left(put(_N_,4.)));
run;
%local num;
data Des;
if 0 then set Des nobs=VARNUM;
call symput('num',left(put(VARNUM,8.)));
stop;
run;
data cara;
set cara;
/*data _null_;
if 0 then set cara nobs=count;
call symput('num',left(put(count,8.)));
stop;
run;*/;
%do i=1 %to #
proc freq data=cara order=freq;
tables &&nomvar&i/out=table&i;
data tabl&i;
set table&i;
if _N_ le 10;
%end;
%do i=1 %TO &nb_tb;
proc sort DATA=tabl&i.; BY &&nomvar&i;run;
proc transpose DATA=tabl&i. out=tabl&i._tr;
BY &&nomvar&i;
run;
proc sort DATA=tabl&i._tr; BY _name_;run;
proc transpose DATA=tabl&i._tr out=tabl&i._tr;
id &&nomvar&i;
BY _name_;
run;
/*proc sort DATA=tabl&i._tr; BY _name_;run;
proc transpose DATA=tabl&i._tr out=toto&i._tr;
id cle;
BY _NAME_;
run;*/
%end;
%mend; |
Partager