标题仅在首页

时间:2015-09-02 16:00:43

标签: sas

这是我第一次使用编程相关的堆栈。因此,如果这不属于或应该去某个地方,请通知我,我会解决它。

我刚刚开始使用SAS Studio。我相信我已经正确设置了一个标题,但我似乎无法在第一页上获得它。它将标题添加到我创建的每个后续页面中。我刚刚开始在SAS网站上观看教程,但我还没有碰到这个特定问题的答案。任何人都可以帮我指点正确的方向吗?

这是我的代码:

Data Question21;
Input Transfers Broken @@;
Datalines;
1 16 0 9 2 17 0 12 3 22 1 13 0 8 1 15 2 19 0 11
;

title color=red Bold underlin=3 "Assignment #1";

Proc Print;
run;

Proc sgplot;
scatter x=Transfers y=Broken;
run;

Proc reg;
model Broken=Transfers;
run;

这是运行时会发生什么的示例:Output Data

1 个答案:

答案 0 :(得分:3)

TITLE是一个全局声明,直到您关闭它才会生效。所以简单的答案是:在您想要标题的PROC及其RUN语句(或使用quit的QUIT)之后,输入

title;

然后将清除所有标题。

更详细一点:

标题和脚注,有一组十个(每个)处于某种“堆叠”(设置一个删除所有较高的)。 SAS在内部存储它们,并且只要PROC或其他任何支持标题的内容运行,它就会抓取标题和脚注堆栈中当前的内容,并显示这些标题和脚注。

重要的是要记住,在达到PROCDATA之前,任何RUNQUIT步骤都不会完全提交,或者其他PROCDATA步骤开始(称为“步边界”)。由于TITLE是一个全局语句,所以当到达步边界时,将显示当前标题栈中的任何内容。注意你在这里看到的......

title "One Title";
proc print data=sashelp.class;
title "Two Title";
run;
title "Three Title";
proc freq data=sashelp.class;
tables sex*age/list;
run;
title "Four";

一个好习惯是始终将TITLE个陈述放在一致的地方 - 有些人不同意的地方,但请选择:

  • PROC / DATA声明之前
  • 紧接RUN
  • 之前

坚持下去。然后,在每RUN之后,请添加TITLE;,除非您有意拥有共同的标题。

例如,我的作业可能会打印SASHELP.CLASS,在其上运行一些频率,并使用PROC UNIVARIATE查看WEIGHTHEIGHT个变量

title "SAS Class, Assignment One";
title2 "Written By Joe, 9/2/2015";  *these are global titles used for all printing;

title3 "Print of first 10 obs of SASHELP.CLASS";
proc print data=sashelp.class(obs=10);
run;
title3;

title3 "Freq of AGE, SEX in SASHELP.CLASS";
proc freq data=sashelp.class;
  tables age sex;
run;
title3;

title3 "Univariate Examination of SASHELP.CLASS";

title4 "HEIGHT variable";
proc univariate data=sashelp.class;
  var height;
run;
title4;

title4 "WEIGHT variable";
proc univariate data=sashelp.class;
  var weight;
run;
title3; *notice 3 here - ending all of 3;

title3 "Plot of SASHELP.CLASS Height v Weight";
proc sgplot data=sashelp.class;
  scatter x=weight y=height;
run;

title; *ends all titles!;
相关问题