h******e 发帖数: 1791 | 1 比如总数多少,character多少,numeric多少,存到macro varible里。 | s********p 发帖数: 637 | 2 %let outvar=;
%macro cal_var_nums(indata);
proc contents data=&indata out=out noprint; run;
proc sql noprint;
select count(name) into :outvar
from out
;
quit;
%mend;
%cal_var_nums(model(obs=0));
%put "Total variable:" &outvar;
%cal_var_nums(model(obs=0 keep=_NUMERIC_ ));
%put "Num variable:" &outvar;
%cal_var_nums(model(obs=0 keep=_CHARACTER_ ));
%put "Char variable:" &outvar;
【在 h******e 的大作中提到】 : 比如总数多少,character多少,numeric多少,存到macro varible里。
| a********s 发帖数: 188 | 3 data one;
input a b$ c$ d e;
cards;
1 a b 2 3
;
run;
proc contents data = one out=two(keep = name type);
run;
proc sql;
select count(*), sum(type=1), sum(type=2) into: total, :num_total, :char_
total
from two;
quit; |
|