【发布时间】:2016-12-25 11:17:49
【问题描述】:
这里是一个 SAS 代码示例:
ODS LISTING CLOSE;
GOPTIONS DEV=SASPRTC;
ODS PDF FILE="test_toc.pdf" CONTENTS=YES ;
ODS DOCUMENT NAME=REPORTTOC(WRITE);
ODS PROCLABEL="1 - Title level 1" ;
TITLE1 "1 - Title level 1" ;
TITLE2 "1.1 - Title level 2: Horsepower" ;
PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="1.1 - Title level 2: Horsepower";
COLUMN Horsepower ;
DEFINE Horsepower / DISPLAY PAGE CONTENTS="" ;*Note1: According to SAS documentation, contents="" should delete "Table 1" from the TOC but it does not work;
RUN;
TITLE2 "1.2 - Title level 2: Type" ;
PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="1.2 - Title level 2: Type";
COLUMN type ;
DEFINE type / DISPLAY PAGE CONTENTS="" ;*Note2: idem;
RUN;
ODS PROCLABEL="2 - Title level 1" ;
TITLE1 "2 - Title level 1" ;
TITLE2 "2.1 - Title level 2: Horsepower" ;
TITLE3 "2.1.1 - Title level 3: Horsepower" ;
PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="2.1 - Title level 2: Horsepower";
COLUMN Horsepower ;
DEFINE Horsepower / DISPLAY PAGE CONTENTS="2.1.1 - Title level 3: Horsepower" ;
RUN;
TITLE2 "2.2 - Title level 2: Type" ;
TITLE3 "2.2.1 - Title level 3: Type" ;
*Note3: Can I add another level of title (TITLE4) in the TOC before the display of this PROC REPORT? ;
PROC REPORT DATA=SASHELP.CARS(obs=5) NOWINDOWS CONTENTS="2.2 - Title level 2: Type";
COLUMN type ;
DEFINE type / DISPLAY PAGE CONTENTS="2.2.1 - Title level 3: Type" ;
RUN;
ODS DOCUMENT CLOSE;
ODS PDF CLOSE;
GOPTIONS RESET=ALL;
ODS LISTING;
PROC DOCUMENT NAME=REPORTTOC(update);
MOVE Report#2\Report#1 TO report#1 ;
MOVE Report#4\Report#1 TO report#3;
RUN;
ODS PDF FILE='test_toc.pdf' CONTENTS=YES ;
REPLAY; RUN;
ODS PDF CLOSE;
QUIT;
我的问题是我希望能够在不使用更多过程的情况下在 TOC 中添加级别(参见代码示例中的 Note3)。
我想直接链接 TOC 中的 TITLE 语句,而不使用 ODS PROCLABEL="text" 或 CONTENTS="text"。
有可能吗(我正在运行 SAS 9.2)?
【问题讨论】:
-
虽然堆栈溢出社区喜欢帮助人们解决问题,但他们确实希望人们提出问题表明他们首先尝试自己解决问题。 google 上有很多目录示例。如果您已完成此操作并且在创建目录时遇到特定问题,请包含显示您遇到的问题的相关代码。
-
什么是“自动拨号”?那是链接/书签吗?
-
@RobertPenridge 我真的很想先解决我的问题,我在目录上看到了很多东西,但只有 2 或 3 个级别。我制作的“最佳”目录是使用“ODS PROCLABEL='My Label'”和 PROC DOCUMENT 来重新组织我的报告。但是如果我想要超过2或3个级别,我不知道该怎么做。
-
@Reeza: '自动拨号' 表示我想在标题前加上自动号码:1 1.1 1.2 etc.
-
@Joe 我编辑了我的问题;我希望它会告诉你我在问我的问题之前做了一些事情,我希望我的问题更加清晰和有用。
标签: pdf sas tableofcontents