BookmarkSubscribeRSS Feed
DonH
Lapis Lazuli | Level 10
I am generating a large document in PROC REPORT (lots of BY Groups) and would like to use the automatically generated bookmarks. There are two variable names and they are both long. The end user wants the bookmark text to be just the values of the variables; i.e., not "varname1=varvalue1 varname2=varvalue2"

I am pretty sure that I can do this by not using a BY statement and writing a macro to loop thru the values and execute PROC REPORT on each by group (using WHERE clauses to subset the data), but I would prefer to not have to write such a macro.

So my question is whether this is possible and, if so, how.
4 REPLIES 4
DonH
Lapis Lazuli | Level 10
Meant to add that this is for 9.1.3 and not 9.2.
Cynthia_sas
SAS Super FREQ
Hi:
My preferred method to rearrange, relabel, restructure the TOC/bookmarks for PDF or HTML is to use ODS DOCUMENT. You have 1 major hurdle...in SAS 9.1.3, ODS DOCUMENT didn't support PROC REPORT ... but it does in 9.2. So if you had 9.2, that's what I'd recommend instead of the macro approach.

For SAS 9.1.3, I'd go with this approach:
[pre]

ods pdf file='c:\temp\pdfbk_alt.pdf';
ods proclabel 'Use CONTENTS=';
proc report data=shoes nowd contents="Asia";
where region = "Asia";
column product sales inventory returns;
define product / group;
rbreak after / summarize;
run;

ods proclabel ' ';
proc report data=shoes nowd contents="Canada";
where region = "Canada";
column product sales inventory returns;
define product / group;
rbreak after / summarize;
run;

ods proclabel ' ';
proc report data=shoes nowd contents="Pacific";
where region = "Pacific";
column product sales inventory returns;
define product / group;
rbreak after / summarize;
run;

ods pdf close;
[/pre]

...which you can see is just primed for using macro variables in the where and contents= option. The ODS PROCLABEL gets rid of "The Report Procedure", but to get rid of the TOC item/icon itself, I believe you have to use ODS DOCUMENT. Some of the style template methods that changed bullet points, and spacing in the HTML TOC did not impact the PDF TOC, as I remember.

cynthia
DonH
Lapis Lazuli | Level 10
Thanks Cynthia. I created an article on sasCommunity about this:

http://www.sascommunity.org/wiki/Customizing_PDF_By_Variable_Bookmarks

Please feel free to comment/improve/correct as you see fit. We will likely also create a Tip of the Day for it.
Cynthia_sas
SAS Super FREQ
Hi, Don:
Very nice example! While I like the ODS DOCUMENT method, this is -exactly- what I would do in SAS 9.1.3.

cynthia

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1039 views
  • 0 likes
  • 2 in conversation