BookmarkSubscribeRSS Feed
lueryy2000
Calcite | Level 5
Hi,

I am working on a pie chart using SAS. This graph will be included in a journal paper. I am worried about the quality since I produced the same pie chart in R. The one in R looks much nicer than the one in SAS. Below are my questions concerning the graphing:

1. What type of the format should I use when I output the plot to a graph device? I tried both pdf and gif file, pdf file can't be easily inserted into a Microsoft Office document, like powerpoint. Gif file could, but the image looks poor, especially the edge of the circle looks rough. I hope the file has high-quality and is incorporated into word/powerpoint.

2. If my code doesn't produce high-quality plot. How to improve the quality? Below is my full code (One for gif device and one is pdf device).

data temp;
input reactivity $20. total;
datalines;
Autologous_only 162
Autologous_other_Flu 99
Flu_not_Autologous 6
OTHER 192
;
run;

goptions device=gif gsfname=gout xpixels=1024 ypixels=768;
filename gout 'H:\pie.gif';
proc gchart data=temp;
pie reactivity / sumvar=total noheading slice=arrow value=arrow;
run;
quit;



ods listing close;
ods pdf file='H:\pie2.pdf' notoc;
proc gchart data=temp;
pie reactivity / sumvar=total noheading slice=arrow value=arrow;
run;
quit;
ods pdf close;
ods listing;

Any input would be appreciated.

Thanks,
Lu
8 REPLIES 8
DanH_sas
SAS Super FREQ
What version of SAS are you using?
Cynthia_sas
SAS Super FREQ
If you want an image that can be cut and pasted into a Word doc, have you tried ODS RTF??? That will put a paste-able image into an RTF file that should render nicely in Word. JOURNAL style is a black/white/gray style designed for journal publications, but you if you can have color output, then you can also try STYLE=ANALYSIS or STYLE=STATISTICAL (or any of the other SAS styles).

cynthia
[pre]
options center nodate nonumber;
ods rtf file='c:\temp\pie_journal.rtf' style=journal;

goptions reset=all xpixels=1024 ypixels=768;
proc gchart data=temp;
pie reactivity / sumvar=total noheading slice=arrow value=arrow;
run;
quit;

ods rtf close;

[/pre]
lueryy2000
Calcite | Level 5
Thank you for replying. I tried it but the quality is not good enough. At least the edge looks not smooth. Other than RTF, do you think gif, png or any other format would work?

Thanks,
Lu
DanH_sas
SAS Super FREQ
Try this and see if it gives you the quality you want:

[pre]
ods listing close;
goptions device=sasprtc;
ods pdf file='pie2.pdf' notoc dpi=600;
proc gchart data=temp;
pie reactivity / sumvar=total noheading slice=arrow value=arrow;
run;
quit;
ods pdf close;
ods listing;
[/pre]
lueryy2000
Calcite | Level 5
Thank you for your reply. This code does generate a much nicer plot than my code using pdf device. What do "device=sasprtc" and "dpi=600" mean here? Sorry not very familiar with the graphing code. Since I want to cut and paste it to a paper, pdf file has quality but can't fulfill the purpose. Do you have other suggestions?
Thanks,
Lu
Bill
Quartz | Level 8
While the best option is to produce a graphics file that can just be imported, cut & paste from pdf with good resolution is possible. Follow the instructions below.

Images that are transferred from pdf to Word, Powerpoint or other applications may have poor resolution. These instructions will help to ensure that maximum resolution is achieved.

Actions required

Open the pdf file with Acrobat Reader.

To capture images, first enlarge the image with the “Zoom Tool” until the section of interest fills the screen. Then select the “Snapshot Tool” . The cursor will change to crosshairs. Capture the area of interest by clicking and then dragging the cursor across the area to be transferred. Release the cursor when the image is highlighted.

Go to the application to which the image is to be added and choose “Edit, Paste Special, Picture (Enhanced Metafile)” to deposit the image.

Additional Actions

To crop or re-size the image, choose “View, Toolbars, Picture” to access the image editing tools.
lueryy2000
Calcite | Level 5
Thank you. I tried it and it works well. This is the best way at this point. I appreciate it.
Lu

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 8 replies
  • 1468 views
  • 0 likes
  • 4 in conversation