When I create a PDF image in SAS, a blank margin area is created around the image that I don't want. Here's an example where I plot the same image twice, first as a PNG, and then as a PDF. Note that the PDF has extra white space outside of the border while the PNG does not. How do I get rid of that extra white space in the PDF?
ods html close; ods listing; ods graphics / reset=all outputfmt=png imagename="Test image"; proc sgplot data=sashelp.class; scatter x=age y=weight; run; ods graphics / reset=all outputfmt=pdf imagename="Test image"; proc sgplot data=sashelp.class; scatter x=age y=weight; run; ods listing close;
Note that I just want a stand-alone image file in PDF format, just like the PNG created above. I don’t need the margins because I’ll be embedding the image file within a manuscript.
Here are the ODS graphics options I use most often. The height and width options may address your issue. I find that imagefmt=PDF results in better looking plots, but the resulting file size can be much larger than imagefmt=PNG, depending on the number of data points.
ODS GRAPHICS ON/reset
border = off
height = 100pct
width = 100pct
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.