BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gfish
Fluorite | Level 6

Hi,

 

I am using proc sgplot to generate graphs and trying to save the generated graphs using ods listing. The generated graphs are then imported into excel using DDE.

 

My current problem is that an increment number is automatically appended at the end of the file name (e.g., filename.png for the first time execution, filename1.png for the 2nd time execution, and so forth). Anyone knows how to surppress this setting? By the way, I am on 9.4.

 

The following is how my code looks like:

 

goptions reset=all gsfmode=replace;
ods graphics/imagename="MSS_freq" Imagefmt=PNG ;
ods listing gpath="C:\temp";

 

proc sgplot;

<snip>

 

Thanks ahead,

 

C.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

?? What do you want instead?  If you just want every file to be called "MSS_freq," then either

1. Delete the previous copy of that file before you create the new file.

2. Put RESET=ALL or RESET=INDEX on the ODS GRAPHICS statement, like this

    ods graphics / imagename="A" imagefmt=png reset=index;

 

The RESET=IMAGE option was added in SAS 9.4m3. Here is the documentation of the RESET=INDEX option.

 

View solution in original post

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, this sounds all weird to me.  Firstly DDE is very ancient (pre 2003) and really isn't the way forward.  Secondly, why create graphs in SAS, then paste them as images into Excel, doesn't that defeat the purpose of either technology?  Either output graphs as data + report from a SAS standpoint, or send the data to Excel and do your graph in that.  Otherise you have a picture whichis not editable in either.

 

As for the filenaming, that is pretty standard, each time a new image is created its incremented.

 

Personally I would drop Excel, create your reports in SAS.  However if you have to use Excel, then dump the data there and graph in that. 

Gfish
Fluorite | Level 6

Hi, 

 

Thank you for the quick reply. I am working on a review file (format) that was previously put in excel (multiple sheets in different tabs, automatically colored cells given some criteria, and the a few graphs in different tabs). The review file needs to be automatically generated. I understand that DDE is quite old and not receving much support from Microsoft, but I need to add the graphs into excel automatically.

 

It sounds like there is no way around avoiding SAS generating the increment file name using ods listing???

 

 

ballardw
Super User

Specify a different imagename in an ODS graphics statement before each SGPLOT procedure call.

Though if you use by group processing the image names will still get incremented.

 

I do agree that putting images into Excel this way borders on unnatural though I suspect you have someone that insists on Excel output.

If that is the case I would be tempted to see if I could get by with creating an HTML document with all the graphs and then converting that.

Rick_SAS
SAS Super FREQ

?? What do you want instead?  If you just want every file to be called "MSS_freq," then either

1. Delete the previous copy of that file before you create the new file.

2. Put RESET=ALL or RESET=INDEX on the ODS GRAPHICS statement, like this

    ods graphics / imagename="A" imagefmt=png reset=index;

 

The RESET=IMAGE option was added in SAS 9.4m3. Here is the documentation of the RESET=INDEX option.

 

Gfish
Fluorite | Level 6

Yes, I do want each graph to be named the same so that I can pass on the names as macro variables when inserting the graphs. 

 

I tried RESET=INDEX, it worked. 

 

Many thanks, Rick and all of you that replied!!!

 

C.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 5 replies
  • 2567 views
  • 4 likes
  • 4 in conversation