Data visualization with SAS programming

Output Graph as .png

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 81
Accepted Solution

Output Graph as .png

Hello all,

 

I was trying to output my graph as a PNG file, but nothing came out under my directory. Following is my code: 

filename grafout 'E:\test.png';
goptions reset=all gsfname=grafout gsfmode=replace device=png;
proc sgplot data=plot;
   vbox value / category=time group=TreatName ;
run;
quit;
filename grafout clear;

Anyone has any idea about output the graph? Thank you very much!


Accepted Solutions
Solution
‎01-15-2018 05:32 PM
SAS Super FREQ
Posts: 1,047

Re: Output Graph as .png

Do it this way:

 

ods listing gpath='E:\';
ods graphics / imagename="test" imagefmt=png;
proc sgplot data=plot;
   vbox value / category=time group=TreatName ;
run;

View solution in original post


All Replies
Solution
‎01-15-2018 05:32 PM
SAS Super FREQ
Posts: 1,047

Re: Output Graph as .png

Do it this way:

 

ods listing gpath='E:\';
ods graphics / imagename="test" imagefmt=png;
proc sgplot data=plot;
   vbox value / category=time group=TreatName ;
run;
SAS Super FREQ
Posts: 1,047

Re: Output Graph as .png

GOPTIONS do not apply when using the SG procedures. Use the ODS GRAPHICS statement for global options.

 

Hope this helps!

Dan

Frequent Contributor
Frequent Contributor
Posts: 81

Re: Output Graph as .png

ODS GRAPHICS works well! Thanks for your help! I could get the output now!
Frequent Contributor
Frequent Contributor
Posts: 81

Re: Output Graph as .png

By the way, do you know how to end this ODS GRAPHICS? Also, do you know how to set the ticks inside? Since it's showed that "TICKSTYLE=INSIDE " could only be applied in SAS 9.4M5 version or later. Mine is SAS 9.4M2.
SAS Super FREQ
Posts: 1,047

Re: Output Graph as .png

ODS GRAPHICS is not an ODS destination statement, like HTML or PDF. It does not have to be closed.

 

ODS GRAPHICS can be turned on and off (e.g. ods graphics offSmiley Wink; but the on/off does not affect the SG procedures. The on/off for controlling ODS Graphics output from SAS/STAT and other procedures that support that output.

 

As you said, the TICKSTYLE option was added after 9.4m2; however, it is definitely possible to annotate the tick marks on the inside. Here is a reference to a paper I wrote about annotation that should help you get started if you have not used annotation in this system.

 

Now You Can Annotate Your Statistical Graphics Procedure Graphs

 

Hope this helps!

Dan

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 285 views
  • 0 likes
  • 2 in conversation