BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm a bit confuse on how to modify the name of a graphics image file.

It seems like the only thing to do is to enable the IMAGENAME= option in the ods graphics statement, but it doesn't work well for me..
(ref: http://support.sas.com/rnd/app/da/stat/odsgraph/faq.html)

Would that be the problem that I use ODS HTML at the same time?

The following is my code:
ods html path = "C:\QA2"
gpath = "C:\QA2\gif" (url="gif/")
file = "test.htm";

ods graphics on / imagename = "MyName"
imagefmt = png;

proc gplot;
...
plot statement;
...
quit;

ods graphics off;
ods html close;



With this code, I was able to save the output in HTML format in C:\QA2 as well as graphics file (named gplot.png) in C:\QA2\gif. I was hoping the IMAGENAME option would change the name to MyName.png and save it at C:\QA2\gif. Am I missing something?

Thanks!!
5 REPLIES 5
David_SAS
SAS Employee
PROC GPLOT is not a statistical graphics procedure, and thus doesn't honor the ODS GRAPHICS statement. With SAS 9.2, the new PROC SGPLOT is production. It does honor the ODS GRAPHICS statement. (In fact, you don't even have to specify ODS GRAPHICS if you're happy with its defaults.)

You can learn about PROC SGPLOT here:

http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/sgplot-chap.htm

-- David Kelley, SAS
Cynthia_sas
Diamond | Level 26
And, for regular SAS/Graph procedures, most procedures support the NAME= option which would be the name that is used by SAS/Graph to assign a name to your file (other than GPLOT1, GPLOT2, etc)

If you look in the SAS/Graph documentation for your procedure of choice, you can see how and where the NAME= option goes.

cynthia
deleted_user
Not applicable
Thanks for the suggestions. I see both methods are useful, i enjoy exploring different ways to meet the same goal.

Also, when I tried to customized the plot, it seems like PROC GPLOT can be a better tool if the graph is fairly straight forward with fewer items to customized. Because we can simply specify the AXIS statement in order to modify the axis label, position, angle, major and minor ticks and etc. But if for PROC SGPLOT, we need to do it by changing the default template in PROC TEMPLATE.
Cynthia_sas
Diamond | Level 26
Hi:
Actually, if you look at the documentation, you will see that SGPLOT, in particular has several AXIS statements that you can use without venturing into Graph Templates.
cynthia
http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/xaxis-stmt.htm
deleted_user
Not applicable
That's very good tips. I must have missed that part.

Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1264 views
  • 0 likes
  • 3 in conversation