在SAS中,如何向.LST输出文件添加注释。就像在执行proc打印之前添加评论“这是tbl_TestMacro的输出:”一样?这样我的输出文件将显示为:
This is the output for tbl_TestMacro:
Obs field1 field2
1 6 8
2 6 9
3 7 0
4 7 1
而不仅仅是:
Obs field1 field2
1 6 8
2 6 9
3 7 0
4 7 1
谢谢,Dan
答案 0 :(得分:7)
对于数值计算语言问题(例如SAS和R),stackoverflow实际上可能会有更多的运气。
但无论如何我会试着去试试。 TITLE
和PUT
都可以用于您的目的:
title "This is the output for tbl_TestMacro:";
或
put This is the output for tbl_TestMacro:;
答案 1 :(得分:2)
我相信“put”会将答案放在日志中,而不是列表中。
标题可以使用,但它只将标题放在页面顶部。
SAS内部没有优雅的方法将文本注释与输出结合起来。我所知道的最好的工具是SASweave和StatWeave,两者都是由Russ Lenth开发的。他们可能需要比你愿意付出更多的时间投入。或者,你可以使用R和Sweave。
然而,一种丑陋的方法是使用您想要的文本创建数据集,并使用如下例程:
data mytext;
text = "This is the output for tbl_TestMacro";
run;
proc print noobs data = mytext split='*';
var text;
label text = '*';
run;
(这意味着没有变量标签的更好的快捷方式,但我没能使它工作。)
答案 2 :(得分:2)
或者你可以做到
data _null_;
file print;
put "this is the output";
file log;
run;
有关更改“put。”目的地的详细信息,请参阅http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000171874.htm。