BookmarkSubscribeRSS Feed
Barkat
Pyrite | Level 9

I was trying to create a pdf output file of few charts using the following step. But I cannot fix the following problems.

 

a) The title line automatically breaks after about 70 characters and the next line starts in random places (not aligned left with the previous line). I want the title line as we write in a word file.

 

b) All the texts (texts in the chart title, legend, axis labels, axis values)  are stretched vertically.

 

c) The graphs also stretched vertically. How can I specify the chart height and width in the ods pdf?

 

ods pdf file="\\accounts\----\-----\----\test.pdf" notoc startpage=yes ;
title "Drug abuse rates per 100,000 population among patients at selected hospitals in Texas, 2007–2021";
proc sgplot data=have pad=(top=5% bottom=5%) ;
series x=year y=ABC / markers legendlabel="ABC" ;
series x=year y=DEF / markers legendlabel="DEF";
format ABC DEF ;
yaxis label='Rate per 100,000';
xaxis values=(2007 to 2021 by 1) display= (nolabel) NOTIMESPLIT VALUESROTATE= VERTICAL;
run;
ods pdf close;

  

3 REPLIES 3
ghosh
Barite | Level 11

Try

ods graphics on / scale=off;

if this does not work specify size

ods graphics on / width=4.5in height=3.5in;

 

Reeza
Super User
I see no STYLE applied. What is your default style for PDF?
Try explicitly listing a Style if you're not sure.
ballardw
Super User

Your comments 2 and 3 indicate that at some point you have set the ratio of the height and width of your graphics output to something other than the defaults. The ODS Graphics option NOSCALE will override the default behavior of using the ratio of your graphic display areas to set font proportions.

 

You may want to use the ODS Graphics option SHOW to write all of your current graphic settings to the log. Or use ODS Graphics/ reset; at the start of your program. Many of the options will persist across programs and even sessions.

 

Lines of title text breaking are likely a combination of window width and title font; too large of a font for the amount of text in the window and the line breaks. You might consider setting a font for the title or possibly the NOGTITLE option for the ODS PDF statement to move the title text out of the graphics area and into the document body.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 940 views
  • 1 like
  • 4 in conversation