The SAS Output Delivery System and reporting techniques

ods pdf contents and sgplot creates overprinting

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

ods pdf contents and sgplot creates overprinting

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.

 

Accepted Solutions
Solution
‎01-03-2017 11:38 AM
PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

...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


All Replies
Contributor
Posts: 22

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to Chuck_White

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?

Occasional Contributor
Posts: 13

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to bnawrocki

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

PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to Chuck_White

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

 

 

Contributor
Posts: 22

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to Chuck_White

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

PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to bnawrocki

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

Occasional Contributor
Posts: 13

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to bnawrocki

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.

PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to Chuck_White

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

Solution
‎01-03-2017 11:38 AM
PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

...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.
 

Occasional Contributor
Posts: 13

Re: ods pdf contents and sgplot creates overprinting

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

Occasional Contributor
Posts: 13

Re: ods pdf contents and sgplot creates overprinting

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

PROC Star
Posts: 1,167

Re: ods pdf contents and sgplot creates overprinting

Posted in reply to Chuck_White

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 11 replies
  • 808 views
  • 7 likes
  • 3 in conversation