BookmarkSubscribeRSS Feed
EdwardB
Fluorite | Level 6

Hi All

 

I am working on developing PDF based output reports from SAS proc reports and proc sgplots etc. I have been using ODS layout to set up each page to contain a number of these items. This worked fine. The issue I then had was with bookmarking where each proc procedure would have its own bookmark even though it was on the same page. I wanted to add a heirachy to the bookmarking.

 

I sought help and Cynthia provided me her paper on ODS document which was great, being all about setting up your bookmarking through the ODS document process.

 

The issue now however, is I cant see how ODS Layout works when using the ODS document replay process. I haven't been able to find anyting on this topic (using ODS Layout within ODS Document).

 

I have added SAS Cars data sample code (first code to obtain/write the data, second code to use the written file in ods document) below which works fine in terms of bookmarking through ODS Document, but I cannot get ODS Layout to work in the replay process. 

 

ODS Document code - Create Report (second step)

ods html close;

proc document; 
   Options nocenter nodate nonumber;                                                                           
   doc name=work.sashelp_cars_report(Write);                                                             
   dir \;  
   
   make Page_1;
   make Page_2;
   run;   
   
   dir ^^;
   dir Page_1;
   dir ;
   
   
   setlabel \Work.Sashelp_cars\Report#1\Report#1 'Main Table';   
   copy \Work.Sashelp_cars\Report#1\Report#1 TO ^;
   run;   
   
   dir ^^;
   dir Page_2;
   dir ;
   
   copy \Work.Sashelp_cars\Report#2\Report#1 TO ^ ;
   setlabel \Work.Sashelp_cars\Report#2\Report#1 'USA Table'; 
   
   copy \Work.Sashelp_cars\SGPlot#1\SGPlot#1 TO ^;
   setlabel \Work.Sashelp_cars\SGPlot#1\SGPlot#1 'USA Chart'; 
   
   copy \Work.Sashelp_cars\Report#3\Report#1 TO ^;
   setlabel \Work.Sashelp_cars\Report#3\Report#1 'Asia Table'; 
   
   copy \Work.Sashelp_cars\SGPlot#2\SGPlot#1 TO ^; 
   setlabel \Work.Sashelp_cars\SGPlot#2\SGPlot#1 'Asia Chart';  
   run;    
   quit;
   
   ods pdf file="/folders/myfolders/reports/SAS_CARS_DIR.pdf";
  
   proc document name=work.sashelp_cars_report;
   
   replay; 
     
   run; 
   quit;
   
   ods _all_ close;           

 

ODS Document code - Write ODS Document (First step)
ods document name=work.sashelp_cars(write);

/*****--1st Proc Event - National Table--*****/
Proc Report data=sashelp.cars nowd list contents='';
 	ods proclabel = "Page 1 - National Car Sales (Table)";
 	Column Make Type MSRP;

	Define Make / group;
	Define Type / across;
	Define MSRP / sum;
	break before make/ contents='';
Run;
title;

/*****--2nd Proc Event - USA Table--*****/
Proc Report data=sashelp.cars nowd list contents='';
	Where Origin = 'USA';
 	ods proclabel = "Page 2 -USA - Car Sales (Table)"; 
 	
 	Column Make Type MSRP;

	Define Make / group;
	Define Type / across;
	Define MSRP / sum;
	break before make/ contents='';
Run;
title;

/*****--3rd Proc Event - USA Chart--*****/
ods graphics / reset width=5in height=3.5in imagemap;
proc sgplot data=SASHELP.CARS;
	Where Origin = 'USA';
	ods proclabel = "Page 2 - USA - Car Sales (Chart)"; 
	
	title 'USA - Car Sales (Sum) By Make';
	hbar Make / response=MSRP stat=Sum name='Bar';
	yaxis grid;
run;
title;

/*****--4th Proc Event - Asia Table--*****/
Proc Report data=sashelp.cars nowd list contents='';
	Where Origin = 'Asia';
  	ods proclabel = "Page 2 - Asia - Car Sales (Table)"; 
 	
 	Column Make Type MSRP;

	Define Make / group;
	Define Type / across;
	Define MSRP / sum;
	break before make/ contents='';
Run;
title;

/*****--5th Proc Event - Asia Chart--*****/
ods graphics / reset width=5in height=3.5in imagemap;

proc sgplot data=SASHELP.CARS;
	Where Origin = 'Asia';
  	ods proclabel = "Page 2 - Asia - Car Sales (Chart)"; 
	
	title 'Asia - Car Sales (Sum) By Make';
	hbar Make / response=MSRP stat=Sum name='Bar';
	yaxis grid;
run;
title;

ods document close;

/*****--ODS DOCUMENT LIST--*****/
proc document name=work.sashelp_cars; 
    list / levels=all; 
run; 
quit;
 
 

 

 

 

 

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  I am not sure how or whether bookmarks are integrated between ODS DOCUMENT and REPLAY when used with ODS LAYOUT. If you are arranging multiple objects onto 1 page, I would not expect the bookmarks to do anything more than take you to the top of the page, but here's an example of how to do a simple replay, based on the objects created in your work.sashelp_cars DOCUMENT store.

 

  What I notice is that  if I do a simple replay of the objects from the original document store, that the original names for the objects persist in the new bookmarks. So I did things a bit out of order and put the graphs on top with some proc prints underneath and then put some more objects on page 2. (all the object names come from the document store created by your posted code)

 

  For a report like this, my tendency would be to turn bookmarks off, because the whole reason for using ODS LAYOUT is to make a compressed one or two page document, in which case, the bookmarks aren't used when printed and just take up real estate for display on the screen.

 

  For more in-depth help on bookmarks and ODS DOCUMENT and ODS LAYOUT, your best resource is to work with Tech Support.

 

cynthia

 

options orientation=landscape;
ods pdf file='c:\temp\docreplay.pdf' startpage=no;
ods layout gridded rows=2 columns=2 ;
ods region;
   
proc document name=work.sashelp_cars;
replay \Sgplot#1\SGPlot#1;
run;
quit;
    
ods region;
proc document name=work.sashelp_cars;
replay \Sgplot#2\SGPlot#1;
run;
quit;
  
ods region;
proc print data=sashelp.cars(obs=10) contents='';
	Where Origin = 'USA';
	var make model type msrp;
run;

ods region;
proc print data=sashelp.cars(obs=10) contents='';
	Where Origin = 'Asia';
	var make model type msrp;
run;
ods layout end;

ods pdf startpage=now;
  
ods layout gridded rows=1 columns=2 ;
ods region;
 
proc document name=work.sashelp_cars;
replay \Report#2\Report#1;
run;
quit;

ods region;
proc document name=work.sashelp_cars;
replay \Report#3\Report#1;
run;
quit;
 
ods layout end;
ods pdf close;
EdwardB
Fluorite | Level 6

Thanks Cynthia.

 

Yeah I was thinking I may need to go to Tech Support with this one, as I had tried all combinations possible.

 

The only reason I want to find out a way to use LAYOUT with the REPLAY/DOCUMENT process is I will have PDF reports that may be more like 10 pages+, each having three to four  tables or charts on the same page relevant to each business area. So I didnt want to have a bookmark for each individual item as it does when using the standard proc reports/charts with ODS LAYOUT.

 

DOCUMENT is perfect to correct the bookmarks into hierarchical layout, now it seems the ODS LAYOUT wont play ball.

 

Thanks again for time I will share any advance from Tech Support.

 

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
  • 2 replies
  • 1460 views
  • 0 likes
  • 2 in conversation