Data visualization with SAS programming

Question about producing publication-quality graph in SAS

Reply
Contributor
Posts: 49

Question about producing publication-quality graph in SAS

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
SAS Super FREQ
Posts: 888

Re: Question about producing publication-quality graph in SAS

What version of SAS are you using?
Contributor
Posts: 49

Re: Question about producing publication-quality graph in SAS

SAS 9.2.

Thanks
SAS Super FREQ
Posts: 8,716

Re: Question about producing publication-quality graph in SAS

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]
Contributor
Posts: 49

Re: Question about producing publication-quality graph in SAS

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
SAS Super FREQ
Posts: 888

Re: Question about producing publication-quality graph in SAS

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]
Contributor
Posts: 49

Re: Question about producing publication-quality graph in SAS

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
Super Contributor
Posts: 291

Re: Question about producing publication-quality graph in SAS

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.
Contributor
Posts: 49

Re: Question about producing publication-quality graph in SAS

Thank you. I tried it and it works well. This is the best way at this point. I appreciate it.
Lu
Ask a Question
Discussion stats
  • 8 replies
  • 196 views
  • 0 likes
  • 4 in conversation