I apologise in advance if this question is previously asked and answered... I did look around but the answers are somewhat confusing.
It is about doing the simple thing of 1- exporting sgplot in high resolution usable in office documents and 2- keeping the fonts in the labels readable.
Many recommend producing a large size image then shrinking it in the office document to obtain a high resolution image, but the labels become unreadable
Is there any simple straight forward way of doing this? Surely SAS with all its mighty power should have a short cut for this?
I have tried the following, including using the emf or tiff image type:
ODS GRAPHICS / RESET IMAGENAME = 'Image' IMAGEFMT =emf
HEIGHT = 4in WIDTH = 5in;
ODS LISTING GPATH = 'c:\g' ;
proc sgplot data=p2;
vbar ni / response=per fillattrs=(color=deppk);
xaxis discreteorder=data label='Impact' labelattrs=(size=12);
yaxis label='Percent' labelattrs=(size=12 );
run;
But still no success.... any help is greatly appreciated.
Best regards
Hi,
Based on Sanjay's book I usually create an image size close to the size I want the actual graph to be, such as a height of 2in and width of 3in, and then I use Proc Template to create a style that has smaller fonts than usual and use ODS Listing to refer to the style and also produce a high resolution image of 300 dpi. Depending on what version you have you may need to use DPI instead of IMAGE_DPI.
ODS GRAPHICS / RESET IMAGENAME = 'Image' IMAGEFMT =png HEIGHT = 2in WIDTH = 3in;
proc template;
define style styles.TLSPlot;
parent = Styles.listing;
style GraphFonts from GraphFonts /
'GraphValueFont' = (", ",6pt)
'GraphLabelFont'=(", ",8pt)
'GraphDataFont'=(", ",6pt);
end;
run;
ods listing GPATH = 'c:\g' image_dpi = 300 style = style.TLSPlot;
proc sgplot data=p2;
vbar ni / response=per fillattrs=(color=deppk);
xaxis discreteorder=data label='Impact';
yaxis label='Percent';
run;
Thank you for the answer, appreciated
The problem is that the fonts still look rather fuzzy when the image is inserted into powerpoint or word and viewed on the screen, any suggestion of a solution?
Best regards
That's fine. Can you attach an example of the image please? I thought that would have helped with the fonts. I assume you are increasing the size of the image after inserting it into Word?
Best regards
Set the graph size (width and height) to the size it will be in the document, and set a high dpi, like 300 and create a PNG output. If the final graph is to occupy 3.5" in the document, use something like the following.
ods listing image_dpi=300;
ods graphics / reset width=3.5in height=2in;
proc sgplot data=sashelp.cars;
scatter x=horsepower y=mpg_city;
run;
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.