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!
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;
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;
GOPTIONS do not apply when using the SG procedures. Use the ODS GRAPHICS statement for global options.
Hope this helps!
Dan
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 off;); 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
Hi,
Using this code , while running more than one time in a session it is creating with different file name. is there any way we can replace the existing file while running more than one time? I am running the below code; and result is attached. Please help.
filename grafout '/sasdata/picture.png';
goptions reset=all
gsfname=grafout
gsfmode=replace
;
ods listing gpath='/sasdata/';
ods graphics / imagename="picture" imagefmt=png;
PROC SGPLOT DATA = OVRDATA7;
SERIES X = EXTRACT_DT Y = Overcnt;
SERIES X = EXTRACT_DT Y = UBL3Sig;
SERIES X = EXTRACT_DT Y = LBL3Sig;
TITLE 'Override Graph';
RUN;
quit;
Yes, just add a RESET or RESET=INDEX after the / on the ODS GRAPHICS statement. If you use RESET, make sure it is the *first* option after the slash. Otherwise, you might reset other option on your statement.
ods graphics / reset imagename="picture" imagefmt=png;
Hope this helps!
Dan
Thank you so much Dan. Now it is working perfectly. Appreciate your help.
Thank You so much Dan. Now it is working fine. Appreciate your help.
Hi,
I have used below code to create PNG graph but I am not getting title and footnote in outside the graph. I have used nogtitle option but its not working.
What ODS destination are you using?
NOGTITLE / NOGFOOTNOTE does not work for ODS LISTING for graphical output, as all you get is an image with no container (such as an HTML page). Are you just trying to suppress the titles?
NOGTITLE / NOGFOOTNOTE does not work for ODS LISTING for graphical output, as all you get is an image with no container (such as an HTML page). Are you just trying to suppress the titles?
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.