Export Freq table and SGPLOT graph onto same PDF

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 98
Accepted Solution

Export Freq table and SGPLOT graph onto same PDF

hi,

Does anyone know if it is possible to export a frequency table, and histogram onto a same PDF page?

 

Here is the code I use to produce distinct pdf files.

Thanks in advance,

 

 

ds pdf file="&drop.&title._&dtfrom._to_&dtto..PDF";
ods pdf StartPage=Never; 
ods noproctitle; 
TITLE1 "Ratio of Voluntary Account Closures";
proc FREQ data=a_pdf ;
TABLES Voluntary_Closure_Reason /norow nocol ; 
RUN; 
ods pdf close; TITLE1 ; 

ods pdf file='file.pdf';
PROC SGPLOT DATA=b;
VBAR Voluntary_Closure_Reason /
RESPONSE = COUNT;
TITLE 'Status Additions';
RUN; 
ods pdf close; 

Accepted Solutions
Solution
‎09-07-2017 10:03 AM
Super User
Posts: 11,578

Re: Export Freq table and SGPLOT graph onto same PDF

A lot of things will go into the determination of pagination besides the startpage option. If the table is long then there may not be any room for the graph. Or the size options for you graph may want more space and not fit with a small table.

This works for me as an example:

 

ods pdf file="d:\test.PDF" style=meadow;
ods pdf StartPage=Never; 
ods noproctitle; 

TITLE1 "Ratio of Voluntary Account Closures";
proc FREQ data=sashelp.class (obs=5) ;
   TABLES name /norow nocol ; 
RUN;
 
PROC SGPLOT DATA=sashelp.class (obs=5);
   VBAR name /
   RESPONSE = Height;
   TITLE 'Status Additions';
RUN; title;
ods pdf close; 

Note that if you ever close the PDF with the ODS PDF Close anything that follows will likely not be in the same document much less page.

 

I used style meadow as it uses a smaller font than the default PDF wants and makes the table smaller.

View solution in original post


All Replies
SAS Super FREQ
Posts: 379

Re: Export Freq table and SGPLOT graph onto same PDF

Solution
‎09-07-2017 10:03 AM
Super User
Posts: 11,578

Re: Export Freq table and SGPLOT graph onto same PDF

A lot of things will go into the determination of pagination besides the startpage option. If the table is long then there may not be any room for the graph. Or the size options for you graph may want more space and not fit with a small table.

This works for me as an example:

 

ods pdf file="d:\test.PDF" style=meadow;
ods pdf StartPage=Never; 
ods noproctitle; 

TITLE1 "Ratio of Voluntary Account Closures";
proc FREQ data=sashelp.class (obs=5) ;
   TABLES name /norow nocol ; 
RUN;
 
PROC SGPLOT DATA=sashelp.class (obs=5);
   VBAR name /
   RESPONSE = Height;
   TITLE 'Status Additions';
RUN; title;
ods pdf close; 

Note that if you ever close the PDF with the ODS PDF Close anything that follows will likely not be in the same document much less page.

 

I used style meadow as it uses a smaller font than the default PDF wants and makes the table smaller.

Frequent Contributor
Posts: 98

Re: Export Freq table and SGPLOT graph onto same PDF

Appreciate the explanation.
☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 128 views
  • 2 likes
  • 3 in conversation