BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Chuck_White
Obsidian | Level 7

I hope to create a document  store and create a "printed" index using the contents option in the ods pdf command. Unfortunately, I'm having trouble creating a "printed" index for just four graphs created using proc sgplot. Without the contents option, I get four graphs on four separate pages. When I use the contents option, I get the index and all four graphs printed on top of each other on the first page followed by four blank pages. Note that the contents option works as expected when I only use proc report. I'm using SAS version and maintenance release 9.04.01M2P072314.

 

My replay commands are as follows:

ods pdf file=pdfout contents;
proc document name=work.test;
 replay;
run;
quit;
run;
ods _all_ close;

 

The listing of the document store is as follows:

 

SAS Output

Listing of: \Work.test\ Order by: Insertion Number of levels: All Obs Path Type Size
in Bytes Created Modified Symbolic Link Template Label Page Break 1 \SGPlot#1 2 \SGPlot#1\SGPlot#1 3 \SGPlot#2 4 \SGPlot#2\SGPlot#1 5 \SGPlot#3 6 \SGPlot#3\SGPlot#1 7 \SGPlot#4 8 \SGPlot#4\SGPlot#1
Dir 17NOV2016:14:44:3217NOV2016:14:44:32  test 
Graph302017NOV2016:14:44:3217NOV2016:14:44:32  testBefore
Dir 17NOV2016:14:44:3217NOV2016:14:44:32  test 
Graph300417NOV2016:14:44:3217NOV2016:14:44:32  testBefore
Dir 17NOV2016:14:44:3217NOV2016:14:44:32  test 
Graph302017NOV2016:14:44:3217NOV2016:14:44:32  testBefore
Dir 17NOV2016:14:44:3217NOV2016:14:44:32  test 
Graph301617NOV2016:14:44:3217NOV2016:14:44:32  testBefore

 

Suggestions would be appreciated.

 
1 ACCEPTED SOLUTION

Accepted Solutions
TomKari
Onyx | Level 15

...and I'm back.

 

No good news, I'm afraid. Below is the exact text I received from tech support, so there's no real light at the end of the tunnel.

 

Tom

 

----------------------------------------------

 

There is a defect open with the development team on this issue and I have added this tracking number to that defect. The original problem presented in SAS 9.3 caused a read access violation when contents=yes and images were used, and the solution to that defect presented the overwritten image in the table of contents. The underlying code solution is non-trivial, requiring a re-architecture of the "pageof" logic used by ODS PDF. Such a re-architecture would fix the problems described in both of these SASnotes:
 
http://support.sas.com/kb/20/666.html
 
http://support.sas.com/kb/34/573.html
 
I don't have an ETA for a defect fix to both problems nor is there currently an ODS PDF workaround for the problem you described. The recommendation for creating a printable table of contents with a file containing SAS created images and tables is to use ODS RTF.
 

View solution in original post

11 REPLIES 11
bnawrocki
Quartz | Level 8

I don't feel as though I have enough information to answer your question completely. Have you tried adding an ODS STARTPAGE=NOW; statement between your charts?

Chuck_White
Obsidian | Level 7

1.  Sorry to complicate the issue with Proc Document. If you look at my document catelog, all of those "Before" entries work the same as starting a new page.

 

2.  I've simplified the problem statement by using code from the first two SAS 9.4 examples for Proc SGPlot and adding the contents option. I get the same problem. I'm just testing on a couple of figures at a time but I need to implement an index on thousands of figures at a time. My new example is as follows:

 

filename pdfout "!TEMP\SAS Temporary Files\test.pdf";

ods pdf file=pdfout contents startpage=yes;

proc sgplot data=sashelp.class;

  scatter x=height y=weight / group=sex;
run;

proc sgplot data=sashelp.revhub2;
  scatter x=hub y=revenue /
    group=type groupdisplay=cluster clusterwidth=0.5;
  xaxis type=discrete;
run;

ods pdf close;

run;

 

3.  I apologize for taking so long to respond. I'm not trying to use this option on my current projects but I will be needing something like it in the near futures.

 

Chuck

TomKari
Onyx | Level 15

I can't believe it! I was just logging in to post exactly the same problem, and I saw your post right at the top.

 

Here's another version of the problem, and anybody can try it out.

 

Like Chuck, I need a table of contents with SGPLOT output on PDF, and I ran into the same problem. As part of my investigating, I came across a SAS website example of contents with a PDF. Here's the SAS example, slightly changed, which works fine for me:

 

title "Create a Table of Contents";
options nodate;

ods pdf file="~/GoodReport.pdf" contents=yes;

proc print data=sashelp.class;
run;

proc gchart data=sashelp.cars;
vbar type / sumvar=horsepower;
run;
quit;

proc print data=sashelp.class;
run;

ods pdf close;

 

Now, if I make the small change of substituting SGPLOT for GCHART in the middle step, the SGPLOT output appears NOT between the two PROC PRINT outputs, but right at the very beginning of the PDF document, overwriting the table of contents.

 

title "Create a Table of Contents";
options nodate;

ods pdf file="~/BadReport.pdf" contents=yes;

proc print data=sashelp.class;
run;

proc sgplot data = sashelp.cars;
 hbar Make  / response=Horsepower;
run;

proc print data=sashelp.class;
run;

ods pdf close;

 

 

Help!

 

Tom

 

 

bnawrocki
Quartz | Level 8

Well, there is a SAS Usage note saying that the CONTENTS option on the ODS PDF statement is not compatible with SAS/GRAPH or ODS Graphics output. So I guess you will have to find a workaround -- http://support.sas.com/kb/24/317.html

TomKari
Onyx | Level 15

Well, I guess this can be considered solved, although I'm sure you can imagine my next note is going to be to SAS Tech Support asking why I can't have SGPLOT and a table of contents at the same time!!

 

Tom

Chuck_White
Obsidian | Level 7

I appreciate the usage note and it may still apply but I see that it was issued in 2005 for SAS 9.3. SAS has so much documentation that it's hard to find anything "off the beaten path" but I wasn't able to find any update to the usage note you referenced.

TomKari
Onyx | Level 15

Hi, Chuck

 

I've yelled at put in a case to Tech Support to get an update on this issue. As soon as I have a reliable answer from them, I'll post it.

 

Tom

TomKari
Onyx | Level 15

...and I'm back.

 

No good news, I'm afraid. Below is the exact text I received from tech support, so there's no real light at the end of the tunnel.

 

Tom

 

----------------------------------------------

 

There is a defect open with the development team on this issue and I have added this tracking number to that defect. The original problem presented in SAS 9.3 caused a read access violation when contents=yes and images were used, and the solution to that defect presented the overwritten image in the table of contents. The underlying code solution is non-trivial, requiring a re-architecture of the "pageof" logic used by ODS PDF. Such a re-architecture would fix the problems described in both of these SASnotes:
 
http://support.sas.com/kb/20/666.html
 
http://support.sas.com/kb/34/573.html
 
I don't have an ETA for a defect fix to both problems nor is there currently an ODS PDF workaround for the problem you described. The recommendation for creating a printable table of contents with a file containing SAS created images and tables is to use ODS RTF.
 

Chuck_White
Obsidian | Level 7

Hello Tom,

 

Thanks for following up. I'm sure that I'm preaching to the choir but, from my perspective, rtf is only good if you're creating a small set of tables, listings, and figures. Otherwise, you choose between low resolution graphics or unmanageably large files. It'd be different if you could use SVG graphics in rtf.

 

In the mean time, I've  been known to hard code page numbers for sections of my output (not all of the TLF panels...) into a variation on what is presented in the following paper:

http://www.mwsug.org/proceedings/2012/S1/MWSUG-2012-S125.pdf

 

Eventually, I'll put in some kind of official comment for the files of Tech Support.

 

Chuck

Chuck_White
Obsidian | Level 7

Thanks Tom,

 

1.  What I was missing was that MS Word will create it's own pdf documents and those pdf documents are reasonably compact. I've always had Acrobat installed and the Acrobat pdf options were easier to find. My version of Acrobat with my version of MS Word loses text off of graphics when converting proprietary vector graphics from Microsoft. Microsoft does fine when converting their own proprietary format.

 

2.  Whether it's SAS, MS Word, or both, the font sizes and line spacings in the pdf documents produced through MS Word are not exactly as specified in SAS.

 

3.  As long as MS Word is part of your organizations production process, using rtf to produce large tables of contents is a workable solution. All magic comes at a price.

 

Chuck

TomKari
Onyx | Level 15

Hi, Chuck

 

Thanks for the update. That information is good to know...I'm very much a newbie at trying to create PDF output, so the more tips the better!

 

Happy New Year,

   Tom

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
  • 11 replies
  • 2571 views
  • 7 likes
  • 3 in conversation