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;

全部评论

相关推荐

点赞 评论 收藏
分享
牛客41406533...:回答他在课上学,一辈子待在学校的老教授用三十年前的祖传PPT一字一句的讲解,使用谭浩强红皮书作为教材在devc++里面敲出a+++++a的瞬间爆出114514个编译错误来学这样才显得专业
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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