BookmarkSubscribeRSS Feed
Jean_Paul
Calcite | Level 5

Proc document is a good way to customize bookmarks. However, the behaviour of this proc is not clear. With the code attached, I am unable to drop two unwanted bookmarks (Table 1 bookmarks) even if it looks good under proc document. Is anybody can give me some explaination. I have a way to do it correctly using a combination of ods proclabel and contents= but I do not unhderstant why my code does not work:

ecran.jpg

Thanks for your help

Jean-Paul

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi,

  I do not know the WHY. Only the developers and possibly Tech Support know the WHY. If you need to know why, then I would suggest that you open a track with Tech Support.

       

   I only have some recommendations. There are some nodes that are hard to get to with the PROC DOCUMENT code and that extra "Table 1" node in PROC REPORT is one of them.

      

  As an overall approach, I find it easier to rename that "lowest" level node inside PROC REPORT. Then I keep the original document store intact. I don't like moving and renaming things in the original document store. I find that  I often get too many object names wrong with this method. Instead, I make a new copy of a document store, put only the folders I want in the new document store, and then, if I'm using PROC REPORT, my PROC DOCUMENT syntax is much more streamlined. I am only copying what I want and what I want already has the "right" node name.

    

  I discovered that in PROC REPORT and SAS 9.3, the "extra" node was just named "Report" and not Table 1, but I believe that the same technique should work as the one described in this note:

31278 - Table 1 node generated by PROC REPORT

    

  That's the technique I employed in my revision of your code.

cynthia

option ls=100;
data test ;
  set sashelp.class ;
  length PageLabel $40 PageBk $200 ;
  if (lowcase(Sex)='m') then PageId=1 ;  else PageId=2 ;
  PageLabel='Page '||compress(put(PageId,best3.)) ;
run ;
 
proc sort data=test ;
  by descending sex ;
run ;
   
ods listing;
ods document name=mydoctest(write) ;
   
option nodate  center;
** use contents= string on break before with page option;
** in order to influence the node name. Generally, you;
** use this when the break variable is the same value for all obs;
** so you only get this node change at the top of the report.;
 
ods proclabel="";
proc report data=test(where=(sex='M')) nowd
      style(report)={frame=above rules=groups}  ;
  title j=l "Males: Test for Bookmarked PDF file" ;
    column  pageid Sex Name Age Height Weight ;
     define pageid / order noprint ;
     define Sex    / order order=internal noprint ;
     break before pageid / contents = 'Males' page;
   run;
    
ods proclabel="";
proc report data=test(where=(sex='F'))  nowd
      style(report)={frame=above rules=groups} ;
  title j=l "Females: Test for Bookmarked PDF file" ;
     column  pageid Sex Name Age Height Weight ;
     define pageid / order noprint ;
     define Sex    / order order=internal noprint ;
     break before pageid / contents='Females' page;
run;
quit;
ods document close ;
ods listing close;
  
** verify names in document store;
proc document name=mydoctest;
list / levels=all;
run;
quit;
  
** create a NEW document store;
** and copy from original document store into new structure;
** since names are assigned to the 3rd node in the PROC REPORT;
** step, they will carry forward into the PDF toc;
proc document name=work.mynewdoc(write);
  make popsum;
run;
  dir;
run;
  dir popsum;
    
  copy \work.mydoctest\Report#1\Report#1\Report#1 to ^;
  copy \work.mydoctest\Report#2\Report#1\Report#1 to ^;
run;
      
  setlabel \popsum#1 'Population Summary';
run;
quit;
    
** Note, in the document store and the list, the nodes will show  ;
** as "Report" in 9.3 and "Table 1" in 9.2, but in the replay, ;
** they will have the names given in the PROC REPORT code;
    
** Double check the levels in the new document store;
ods listing;
proc document name=work.mynewdoc;
  list / levels=all;
run;
quit;
  
** Replay the new document store;
ods listing close;
ods pdf file="C:\Temp\mynewdoc.pdf" ;
  proc document name=mynewdoc;
    replay ;
  run;
  quit;
ods pdf close;
ods listing;
title;
 

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
  • 1 reply
  • 1888 views
  • 0 likes
  • 2 in conversation