BookmarkSubscribeRSS Feed
Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear all,

I'd like to display on a pdf first some text (my heading) and then a graph which should follow the text on the same page. Unfortunately SAS does a page break after the text and puts the Graph on a new page although I stated

ods pdf startpage=no; Here is my code (I use SAS 9.2 and the graph is correctly displayed yet on the wrong page):

ods pdf open;

ods pdf text = "mytext";

ods pdf startpage = no;

goptions device = sasprtc;

proc gchart data=mydata;

     vbar mynumericvalue / group = mygrouping freq = mynumber patternid = midpoint freq discrete raxis = axis1 maxsi = axis2 gaxis = axis3;

     axis1 label=(h=10 angle=90 'my text') minor=none;

     axis2 label=none;

     axis3 label=none;

run;

ods pdf close;

Is there anything with which I can stop SAS from putting the graph on a new page?

Best wishes

Eva

9 REPLIES 9
DanO_sas_com
SAS Employee

You were so close.  The reason the graph went to the second page is that there was not sufficient size on the page to place it there.  By default in PDF SAS/GRAPH tries to use the entire page  for the graph unless a size has been specified.

pdf file="test.pdf" startpage=no;

text="my text";

goptions vsize=6in border;

gchart data=sashelp.class;

age;run;quit;

pdf close;

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Dan,

with goptions vsize = 6in now the graph is on the first page but the ods pds text is not shown.

And I have another problem (which occured before as well). I want to disply the page numbers in the footnote:

ods escapechar = '~';

footnote "Page ~{thispage} of ~{lastpage}";

The footnote is displayed but thispage and lastpage are displayed just as it is written between the " and ". This does not happen when I display a table with proc report.

Eva

DanO_sas_com
SAS Employee

Eva,

What release are you using.  The example that I posted worked for me at 9.2 and at 9.3.  I see that the code that I posted was truncated though. So I will try to repost it now.

ods pdf file="test.pdf" startpage=no;

ods text="my text";
goptions vsize=6in border;

proc gchart data=sashelp.class;

vbar age;run;quit;
ods pdf close;

The ~{thispage} and ~{lastpage} not working with graphs yet.

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear all,

I solved the problem now by not using ods pdf text=""; but instead title ""; Now the text and the graph are shown on the same page.

pdf and graph is always a bit tricky.

I use SAS 9.2 on UNIX with the SAS portal.

Best wishes

Eva

MikeZdeb
Rhodochrosite | Level 12

hi ... following produced 1 page (but so did startpage=no ... using V9.3 in windows XP) ...

ods results off;
ods listing close;

ods pdf file='z:\test.pdf'
        text = "This is a plot of weight and height using SASHELP.CLASS."
        startpage=never
        notoc
;

goptions reset=all ftext='calibri' htext=2 gunit=pct;

* move plot away from text;
title ls=2;

* move plot away from bottom edge;
footnote1 ls=2;


symbol1 f='wingdings' v='6c'x c=blue;

proc gplot data=sashelp.class;
plot weight * height / noframe;
run;
quit;


ods pdf close;
ods results;
ods listing;

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Dear Mike,

I read in the manuel that startpage=never should be used with graphs. So I tried it but it didn't work either. Maybe this is due to the SAS version, although I found the hint in the manual for SAs 9.1.3 and I use 9.2 on Win XP

Eva

MikeZdeb
Rhodochrosite | Level 12

hi ... just tried it in V9.2 ... two pages versus one in V9.3

you are correct !!!

DanO_sas_com
SAS Employee

We try to urge people to not use the startpage=never.  It just has never worked very well.

Eva
Quartz | Level 8 Eva
Quartz | Level 8

It does work with table though in my example. The problem seems to be with graphs.

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
  • 9 replies
  • 4594 views
  • 0 likes
  • 3 in conversation