The SAS Output Delivery System and reporting techniques

Suppress BY Variable Names and = Sign in PDF Bookmarks

Reply
Frequent Contributor
Posts: 148

Suppress BY Variable Names and = Sign in PDF Bookmarks

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.
Frequent Contributor
Posts: 148

Re: Suppress BY Variable Names and = Sign in PDF Bookmarks

Meant to add that this is for 9.1.3 and not 9.2.
SAS Super FREQ
Posts: 8,743

Re: Suppress BY Variable Names and = Sign in PDF Bookmarks

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
Frequent Contributor
Posts: 148

Re: Suppress BY Variable Names and = Sign in PDF Bookmarks

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.
SAS Super FREQ
Posts: 8,743

Re: Suppress BY Variable Names and = Sign in PDF Bookmarks

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
Ask a Question
Discussion stats
  • 4 replies
  • 225 views
  • 0 likes
  • 2 in conversation