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
|
%macro verif_num_char(string);
DATA _NULL_;
var=input("&string" ,?? COMMA8.);
IF var=. then call symput('type','CHAR');
else call symput('type','NUM');
run;
%put &type;
%mend;
%verif_num_char(%quote(&ahah));
proc sql;
select J7_OXY_SATEV into : ahah from respi;
quit;
/*Le macro programme ci-dessus ne permet pas de reconnaître une variable caractère contenant des NA, ND en numérique.*/
proc contents data=respi out=temp noprint;
data _null_;
set temp END=EOF;
call symput("type"||left(_N_),type);
call symputx("var"||left(_N_),name);
if EOF then call symputx("nbvar",_N_);
run;
proc delete data=temp;
run;
%DO i_=1 %TO &nbvar.;
%if &&type&i. = 1 %then %do; /*Numériques*/
data _null_;
set &table.;
call symputx("var2",VLABEL(&var.));
run;
proc sql noprint;
select min(J7_D) into : min
from respi;
quit;
proc sql noprint;
select max(J7_D) into : max
from respi;
quit;
data MinMax;
set MinMax;
attrib Var format=$300.;
attrib Min format=$20.;
attrib Max format=$20.;
Var=&var2.;
Min=&min.;
Max=&max.;
run;
%end;
%if &&type&i. = 2 %then %do; /*Caractères*/
/*Le grand vide...*/
%end;
%END;
%IF %sysfunc(exist(MinMax_All)) ne 1 %THEN %DO;
data MinMax_All;
set MinMax_All;
attrib Var format=$300.;
attrib Min format=$20.;
attrib Max format=$20.;
stop;
%end;
data MinMax_All;
set MinMax_All MinMax;
run; |
Partager