BookmarkSubscribeRSS Feed
ammarhm
Lapis Lazuli | Level 10

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

4 REPLIES 4
djrisks
Barite | Level 11

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;

ammarhm
Lapis Lazuli | Level 10

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

djrisks
Barite | Level 11

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

Jay54
Meteorite | Level 14

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;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 919 views
  • 6 likes
  • 3 in conversation