/******将标准集中的变量类型输出**************/proc contents data=Biaozhun out=summary(keep=name type format);
run;
proc sql noprint;
select count(distinct name) into :amount
from summary;
quit;
proc sql noprint;
select distinct name into :name1-:name%left(&amount)
from summary;
select type into :type1-:type%left(&amount)
from summary;
select format into :format1-:format%left(&amount)
from summary;
quit;
%macro new;
%global fmt;
%let fmt=;
%do i=1 %to &amount;
/*分类型定义变量格式:数值型、日期型、文本型*/
%if &&type&i=1 and &&format&i=%str() %then %do;
%let new=%str(&&name&i=&&name&i*1;);
%end;
%if &&type&i=1 and %sysfunc(compress(&&format&i))=%str(DATE) %then %do;
%let new=%str(&&name&i=input(&&name&i,MMDDYY10.););
%end;
%if &&type&i=2 %then %do;
%let new=%str(&&name&i=put(&&name&i,$60.););
%end;
/*将所有变量的转换格式赋值给全局宏变量fmt*/
%let fmt=&fmt %str(&new);
%end;
%mend;
%new;
data Ceshi;
set Ceshi;
&fmt;/*定义测试集中的变量格式*/
run;



雷达卡



京公网安备 11010802022788号







