如何创建名称对应于数据集字段的SAS html文件

时间:2015-07-16 20:58:33

标签: sas sas-ods

我正在尝试为我的SAS数据集中的每条记录创建一个文件。通过使用" newfile = page"我已经能够使用SAS ODS输出成功完成此操作。选项然后只需在数据集上运行proc报告。我遇到的问题是,这导致了通用的,顺序编号的文件名(test,test1,test2等......)。我想根据数据集中的变量命名每个文件。在下面的示例中,我希望根据" seq_nbr"标题为文件名。在数据集中。

    ods html path = "C:\test\"
    file = 'test.html'
    contents = 'contents.html
    frame = 'frame.html'
    code = (url="C:\test\javascript.js")
    newfile=page;

    proc report data = test2 nowindows headline headskip;
    column tDate tTime created_by cmtText;
    by seq_nbr;

    run;

1 个答案:

答案 0 :(得分:0)

你需要一个宏

%macro doit;
proc sql;
select count(*) into :n from test2 ;
quit;

%do i=1 %to &n;
data _null_;
if _n_=&i call symput('name',seq_nbr);
run;

proc export data=something outfile="&name";
run;
%end;

%mend;
%doit;
相关问题