BookmarkSubscribeRSS Feed
AllSoEasy
Obsidian | Level 7

Hey guys,

So I have a macro function that contains 4 calls to proc sgplot, and 1 proc tabulate. This macro is called 22 times to produce graphical/tabular output for 22 different products. Within the macro I have an ods pdf statement, so that all output is written to a single pdf file. I am wondering, if it is possible to suppress SAS from putting in the procedure names into the table of contents, but use my own custom labels. I have attempted this with proclabel, but haven't been able to completely exclude the procedure names, and get it set up how I really would like.

Ultimately, for each product, there will be 5 pages in the output file, 4 graphs from proc sgplot, and 1 table from proc tabulate; I would like there to be just one table of contents entry for each product. So for example setting the contents label at the top of the macro, so the table of contents label comes up "Product1" and then the pdf will contain the 5 pages of output for Product1, and then after the next macro call there will be the second label in the table of contents "Product2" and then all 5 pages for product2, etc..

- The best I have been able to get is a custom label for each procedure, but then the procedure name still comes up, such as:

+Product1

   -sgplot procedure

+Product1

   -sgplot procedure

+Product1

   -sgplot procedure

+Product1

   -sgplot procedure

+Product1

   -tabulate procedure

        -table1

+Product2

  -sgplot procedure

.

.

.

-etc

-When really what I would like is just:

-Product1

-Product2

-Product3

.

.

.

-Product22

So that each table of contents entry will bring me to the first of the 5 pages of output for that product.

Sorry if I am being unclear, I am trying to explain the best I can. Please let me know if I can provide any more clarification of my problem, or if you have any suggestions I can try.

Thanks a lot!!

-Ryan

3 REPLIES 3
Reeza
Super User

I don't know if there's a way to delete them, but you can hide them from showing by default by using pdftoc=1 in your ods pdf statement.

AllSoEasy
Obsidian | Level 7

Ahh yes, I've tried that. The issue is though, that it wont conceal all of my procedures under the one label, it will only conceal the first sgplot, so i get some like:

+Product1

+Product1

   -sgplot procedure

+sgplot procedure

+sgplot procedure

+tabulate procedure

        -table1

+Product2

+Product2

  -sgplot procedure

+-sgplot procedure

.

.

.

etc.

Is there a way I can use this to conceal all procedure names underneath my custom proclabel? I don't care if there deleted or concealed under collapsed labels, either one will work for me!

Thanks!

Cynthia_sas
SAS Super FREQ

Hi:

  Look at this discussion of the  BOOKMARKGEN option (https://communities.sas.com/message/173478#173478). It shows how to selectively turn off the first bookmark, which is what this person wanted. But you could use a similar technique to turn BOOKMARKGEN=ON for the first procedure for Product1, then turn it off after the first procedure for the rest of the Product 1 procedures and then turn it back on for the first of the Product 2 procedures and turn it off for the rest of the Product 2 procedures. Conceptually like what's shown below. This bypasses the need to rename or adjust anything because you will only get a bookmark in the PDF toc for the 1st procedure for any product.

  You can change "The SGPLOT Procedure" subtitle using the DES= option on the PROC SGPLOT statement:

proc sgplot data=mydata.something des='My Pic';

...

run;

  And, while this will control the string that you see, you cannot get rid of the node entirely. The node will still be there, even if you make the string a blank.

  The only way to have a truly customized and restructured table of contents is to use ODS DOCUMENT/PROC DOCUMENT to create a new TOC structure and then copy objects into the new structure. But for what you want (to only go to the first "page" of any Product), I think the BOOKMARKGEN method will work for you.

cynthia

ods pdf file='bigdoc.pdf' bookmarkgen=on bookmarklist=show;

* first procedure for Product 1;

ods pdf bookmarkgen=off;

 

* second procedure;

* third procedure;

 

ods pdf bookmarkgen=on;

* first procedure for Product 2;

    

ods pdf bookmarkgen=off;

  

* second procedure;

* third procedure;

ods pdf close;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 1989 views
  • 0 likes
  • 3 in conversation