BookmarkSubscribeRSS Feed
RoddyJ
Obsidian | Level 7

I'm currently creating a PDF report which includes figures created with SGPlot in a macro. The output of the SGPLOT on it's own if fine, but in the PDF the edge of the plot is being cut off (see examples below).

 

Can anybody suggest why the plots are appearing like this in the pdf?

 

SGPLOT output:

RoddyJ_0-1664551728529.png

Same plot in PDF:

RoddyJ_1-1664551770389.png

SGPLOT macro and ODS PDF code:

/*  SGPlot macro */
%macro team_chart(team_short,type);
	ods graphics on /  height=13cm width=20cm ;
	proc sgplot data=&type._medians_final_&team_short. noborder sganno=anno_&type._&team_short._final dattrmap=attrmap_&type. pad=(right=20%);
	xaxis label='Average time interval (hh:mm)' valueattrs=(size=11pt family=arial) labelattrs=(size=12pt family=arial) offsetmin=0.15  values=('-24:00:00'T '-12:00:00'T '00:00:00'T '12:00:00'T '24:00:00'T '36:00:00'T '48:00:00'T);
	yaxis label='Financial year' valueattrs=(size=11pt family=arial) labelattrs=(size=12pt family=arial);
	hbar fyr / response=median group=t_label grouporder=data nooutline attrid=A barwidth=0.7;
	keylegend / title='Median time from:' titleattrs=(size=11pt family=arial weight=bold) valueattrs=(size=10pt family=arial) noborder location=outside;
	run;
%mend team_chart; 
/* macro used in ODS PDF */
%macro char_teams (type,team_long,team_short,num);
	ods pdf startpage = now; options orientation=landscape;
	footnote h=10pt f=Arial j=c "~{thispage}";
	ods pdf text="~S={cellwidth=27.70cm font_face='Arial' font_size=16pt just=c font_weight=bold foreground=&nhs_blue.}&team_long.";
	ods pdf text=" ";
	ods pdf text=" ";
	ods pdf text="~S={cellwidth=27.70cm font_face='Arial' font_size=12pt just=l font_weight=bold foreground=black}Figure &num. - Median times of &type. organ donation process, &team_long., &st_date. - &end_date.";
	ods pdf text=" ";
	%team_chart(&team_short.,&type.);
%mend char_teams;
4 REPLIES 4
ballardw
Super User

What is the value of your PAPERSIZE?

You may be able to check with:

proc options option=papersize;
run;

The log will show a result. For my system:

 PAPERSIZE=LETTER  Specifies the paper size to use for printing.

Letter is about 27.9cm x 21.6cm or in landscape 21.6 by 27.9. A4 is 29.7 x 21 cm or 21x29.7 in landscape. PDF will use the papersize setting to determine displayed pages.

What size is the PDF displayed?

You may need to set the Orientation before the ODS PDF if you are not getting the landscape sizes. Or adjust the Papersize option.

RoddyJ
Obsidian | Level 7
Thanks for the answer, this hasn't worked I'm afraid. I've tried changing up the order of options and ODS PDF and changing the paper size but sadly no joy.
ballardw
Super User

@RoddyJ wrote:
Thanks for the answer, this hasn't worked I'm afraid. I've tried changing up the order of options and ODS PDF and changing the paper size but sadly no joy.

Time to share sample data that will recreate the problem and complete code, such as the original ods pdf statement.

 

if you are attempting to change from portrait to landscape in the middle of the document that may not work.

Ksharp
Super User
As ballardw said ,try "papersize" option.

options papersize=(200cm 200cm) ;

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
  • 4 replies
  • 565 views
  • 2 likes
  • 3 in conversation