Hi all
I've been scratching my haed for a while now re: ODS pdf
I am using ODS pdf a lot but ths time there is something I can't solve: the grph I output in the pdf is truncated on the left and the right side. I have played a lot with hsize and vsize and it seem to do their job, but the graph inside the defined area appear too big for the area. I was wondering if there was something like 'scaling' the graph to the hsize x vsize area or something clever to correct this.
I have paste the code and attached the output
Cheers!
option orientation=portrait leftmargin="1.0cm" rightmargin="1.0cm" topmargin="1.0cm" bottommargin="1.0cm" papersize=A4 formdlim=' ' center ;
ODS ESCAPECHAR='^';
ods pdf file="C:\temp\test_&datef..pdf" style=statdoc startpage = never notoc ;
Title1 j=c h=5 f=arialb c=vib "Title1" ;
title2 " " ;
Title3 j=r h=2 f=arial c=vib "Done &datef." ;
title4 " " ;
*** page 1 ;
ods pdf style = statdoc text = "^S={just=l font_weight=light font_size=12pt font_face=Arial foreground=vib}2a. Comment1" ;
symbol h= 1 ;
goptions hsize=10cm vsize=10cm vorigin=15.0cm horigin=5.0cm border autosize=on DEV=SASPRTC ;
axis1 value=(h=1 f=swiss) label=(h=1.5 f=swissb "PureBreed Only") ;
axis2 value=(h=1 f=swiss) label=(a=90 h=1.5 f=swissb "PureBreed + CrossBred") ;
title1 h=2 f=swissb c=black "Graph title" ;
title3 h=0.7 " " ;
legend1 value=(h=1 f=swiss) label=(h=1 f=swissb "Country of origin") ;
proc gplot data = graph ;
plot xebv_wwt*ebv_wwt / haxis=axis1 vaxis=axis2 grid nolegend frame ; run ; quit ;
ods pdf close ;
This page might help, ods graphics / height=...;
Note however it may not work with the gplot, which is the old graphing system (pre version 9). Would really recommend moving to sgplot/GTL. If you need examples this blog is my goto for any graphing information:
many thanks for the quick reply - I am battleing here to get SAS Graph ... I am using the BASE STAT package so no SGPLOT for me.
It's really the PDF output that's truncated ; if I print the graph on-screen it looks very OK.
Something to do with maybe defining the printer ?
Very nice blog you have - I have it bookmarked now 🙂
Cheers
Errm, assuming your using 9.2 or later then you should have access to this already, if your on a previous verison of SAS to that there really isn't any reason not to upgrade, from > 9.0 it was just additions.
Yes, Sanjay who started that blog really does give good clear examples on pretty mch any graph you can think of, and with overlays and tiling and such like you can get some real nice outputs.
Going back to your problem, you can try:
ods graphics on / width=4.5in height=3.5in;
It sounds like the image size being created is too big for the PDF age, does it do the same when you output to RTF? Am just thinking that for most graphs I create I goto RTF first, then convert the RTF to PDF.
Otherwise can't help much more as not used gplot in years.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.