BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
whymath
Lapis Lazuli | Level 10

I want to generate a png file through ods listing and ods graphics, and I found a wired thing, with the name of png file.

My code is:

ods listing gpath='D:\' dpi=300 style=htmlblue;
ods graphics/reset=all imagename='test' imagefmt=png;
proc sgplot data=sashelp.class;
  scatter x=height y=weight/group=sex;
run;
ods _all_ close;

Condition A:

There is 0 result at results window. Run the code and get a png file named "test1.png";

Condition B:

There is at least 1 result at results window. Run the code and get a png file named "test.png";

 

How it happens? I want the result is always "test.png", what shoud I do?

Thanks for any advice.

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

If you have more than one ODS destination open, more than one Image file might be created. So for your case, it is best to close any open ODS destinations to make sure only one image file is created.

View solution in original post

4 REPLIES 4
whymath
Lapis Lazuli | Level 10
My SAS version is SAS9.4 TS1M5.
BrunoMueller
SAS Super FREQ

I suggest to close all ODS destinations before you start creating your graph, see example below.

To always get the same filename use 

ods graphics / reset=index;

Sample code:

ods _all_ close;
ods listing gpath='c:\temp' style=htmlblue;
ods graphics/ reset=index imagename='test' imagefmt=png;
proc sgplot data=sashelp.class;
  scatter x=height y=weight/group=sex;
run;
ods _all_ close;
whymath
Lapis Lazuli | Level 10
Amazing! Could you please explain how the first "ods _all_ close;" affect the filename?
BrunoMueller
SAS Super FREQ

If you have more than one ODS destination open, more than one Image file might be created. So for your case, it is best to close any open ODS destinations to make sure only one image file is created.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 489 views
  • 0 likes
  • 2 in conversation