SAS spec_reader宏

%macro spec_reader(data);

data spec;
SET SPEC."&data.$"n;
run;

data spec1;
    set spec;
    where upcase(Domain) ne "DOMAIN" and variable_name ne " ";
run;

data temp;
    set spec1;
    length long $100;
    if upcase(type)="TEXT" then long="$"||length;
     if upcase(type)="INTEGER"  then long="8";
    if upcase(type)="FLOAT"  then long="8";
    if upcase(type)="DATE" or upcase(type)="DATETIME"  then long="$"||length;
run;

data spec2;
    set temp end=eof;
    call symput("attrib"||strip(put(_N_,3.)),"_"||Variable_Name||" "||"length="||strip(long)||" "||"label="||'"'||strip(Variable_Label)||'"');
    if eof then call symput("sum",strip(put(_n_,3.)));
run;


data &data._temp;
    attrib
    %do j=1 %to ∑
        &&attrib&j
    %end;
    ;
    call missing (of _All_);
    if 0;
run;

%mend;

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 14:35
点赞 评论 收藏
分享
06-16 15:04
黑龙江大学 Java
零OFFER战士:另一个版本查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务