目前,我无法生成带有不错的书签和目录的漂亮pdf文件。
理想情况下,我希望有一个如下所示的pdf文档:
第1页(标题页,纵向)
第2页(目录,纵向)
第3页及以后的内容(子类别中的所有表格,横向)
我的基本方法是:
options orientation=portrait nocenter nodate nonumber;
ods pdf file="C:\xyz.pdf" style=sasweb;
ods escapechar='^';
/* Title page */
title;
ods pdf text="^S={just=c} ^20n Document XYZ";
/* ---------- */
/* Table of contents */
ods pdf startpage=now;
title "Contents";
ods pdf text="Classes A & B";
ods pdf text="^S={URL='#Tab1'} Table 1: Class A";
ods pdf text="^S={URL='#Tab2'} Table 2: Class B";
ods pdf text="Classes C & D";
ods pdf text="^S={URL='#Tab3'} Table 3: Class C";
ods pdf text="^S={URL='#Tab4'} Table 4: Class D";
/* ----------------- */
ods pdf startpage=now; /* Start new page ... */
ods pdf startpage=no; /* ... and define no pagination */
title;
options orientation=landscape;
/* Table list */
%macro make_table(in_data=,title=,link=);
ods pdf anchor="&link";
ods proclabel="&title";
ods pdf text="^2n &title";
proc print data=&in_data contents='' noobs;
run;
%mend;
ods pdf text="Classes A & B";
/* Table 1 */
%make_table(in_data=sashelp.class,title=Table 1: Class A,link=Tab1);
/* Table 2 */
%make_table(in_data=sashelp.class,title=Table 2: Class B,link=Tab2);
ods pdf startpage=now;
ods pdf text="Classes C & D";
/* Table 3 */
%make_table(in_data=sashelp.class,title=Table 3: Class C,link=Tab3);
/* Table 4 */
%make_table(in_data=sashelp.class,title=Table 4: Class D,link=Tab4);
/* ---------- */
ods pdf close;
通过所有这些设置,我遇到了几个问题:
这很可能是由于我对输出交付系统的经验不足,但是现在我要为这些看似简单的问题苦苦挣扎数小时。希望有人可以在那里帮助我。
经过大量的反复试验,我终于找到了一种对我有效的方法。我不会发布整个解决方案,因为它比较长,但是总而言之,我做了以下工作:
使用ods文档并proc将所有需要的数据集打印到该文档中。
创建了一个新的ods文档,并使用一个令我满意的目录结构将所有来自先前文档的输出移至此处-这将启用我先前想要的书签结构。我删除了所有带有obpage的分页,并通过obbnote添加了表标题,并通过setlabel添加了正确的书签命名。由于某种原因,我还必须在每个表标题之前插入两到三个回车符。这样,我的链接就不会像以前那样陌生了。
代替这个:
ods pdf text="^S={URL='#Tab1'} ...
ods pdf text="^S={URL='#Tab2'} ...
我用这个:
ods pdf text="^S={URL='#IDX'} ...
ods pdf text="^S={URL='#IDX1'} ...
这样,我不必使用ods pdf锚-声明对我来说似乎是有缺陷的(目录中的链接不正确)。
但是,我仍然不能将子类别直接链接到标题,而只能将其链接到下表。但是,我对此表示满意,因此我不会再尝试了。
如果有人对结果感兴趣,请点击以下链接:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句