I'm creating plots from proc univariate or proc sgplot. It seems that the system always automatically adds a "1" at the end of my imagename. In the example below, it will give me a plot names "abcde1".
ods graphics on / reset width=8in height=6in imagename="abcde";
proc univariate data=Stats;
var x;
histogram / midpoints=10 to 100 by 10;
run;
Any clue how to get rid of this? Thanks!
Here you go. Code with results. HTML is the only thing selected under EG results formats.
Specifying reset=index doesn't change the behavior. If I uncheck HTML in the SAS EG results viewer page and run the code below then it does not add a number to the end of abcde in the name of the .png file.
ods html path="/rtpnfil02/rtpnfil02_vol6/CSDS/CENTER/dhw/Test/" gpath="/rtpnfil02/rtpnfil02_vol6/CSDS/CENTER/dhw/Test";
ods graphics on / reset width=8in height=6in imagename="abcde" ;
proc univariate data=sashelp.class;
var weight;
histogram / midpoints=10 to 100 by 10;
run;
ods html close;
I'm creating plots from proc univariate or proc sgplot. It seems that the system always automatically adds a "1" at the end of my imagename. In the example below, it will give me a plot names "abcde1".
ods graphics on / reset width=8in height=6in imagename="abcde";
proc univariate data=Stats;
var x;
histogram / midpoints=10 to 100 by 10;
run;
Any clue how to get rid of this? Thanks!
I don't see this. When does it happen for you?
ods html file="%sysfunc(pathname(WORK))\abcde.htm" ;
ods graphics on / reset width=8in height=6in imagename="abcde";
proc univariate data=sashelp.class;
var weight;
histogram / midpoints=10 to 100 by 10;
run;
ods html close;
It happened repeatedly. I don't have that "ods html" envelope (below) outside of ods graphics, because I only need the picture file but not the html. Could this be why?
ods html file="%sysfunc(pathname(WORK))\abcde.htm" ;
...
ods html close;
Where do you see a different name?
Thanks for your reply.
Like "abcde1.png" in my folder. Really weird.
Ok, I think I've figured out the issue following this post:
But their solution did not work. In other words, adding ODS HTML close (or ODS LISTING CLOSE) did not work when I was trying a different type of output. What I had to go was go into the EG settings (Tools->Option>-Results) and uncheck HTML. After doing that, the example code posted above, modified to use a listing output, produced an image name with no index attached.
What's happening is that there are two ODS outputs open; listing and html and that's why the index is showing up. Closing the HTML output leaves one output and no index appears in your image name.
Try
ods graphics on / reset=index
That didn't work for me. I have the same issue as the original poster. The issue turns out to be, at least for me using SAS EG, that there is a default HTML destination opened in SAS EG, opened even if you don't specify ODS HTML; in your code, and I had to turn off the default HTML results destination in SAS EG before I could get the index to be suppressed.
@Ksharp wrote:Try
ods graphics on / reset=index
Here you go. Code with results. HTML is the only thing selected under EG results formats.
Specifying reset=index doesn't change the behavior. If I uncheck HTML in the SAS EG results viewer page and run the code below then it does not add a number to the end of abcde in the name of the .png file.
ods html path="/rtpnfil02/rtpnfil02_vol6/CSDS/CENTER/dhw/Test/" gpath="/rtpnfil02/rtpnfil02_vol6/CSDS/CENTER/dhw/Test";
ods graphics on / reset width=8in height=6in imagename="abcde" ;
proc univariate data=sashelp.class;
var weight;
histogram / midpoints=10 to 100 by 10;
run;
ods html close;
Interesting.
reset=INDEX solved my problem. Thanks!!
I've dealt with the same issue for various projects and I FINALLY figured out what I was doing wrong.
This will NOT work:
ODS GRAPHICS / reset=index IMAGENAME="my_map" IMAGEFMT=png NOBORDER; ODS HTML PATH="X:\abc\def" (URL=none); PROC SGMAP MAPDATA=data1 MAPRESPDATA=data2 NOAUTOLEGEND; ESRIMAP URL='http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base'; CHOROMAP abc / MAPID=def ID=def DISCRETE; RUN;
But this DOES work:
ODS HTML PATH="X:\abc\def" (URL=none); ODS GRAPHICS / reset=index IMAGENAME="my_map" IMAGEFMT=png NOBORDER; PROC SGMAP MAPDATA=data1 MAPRESPDATA=data2 NOAUTOLEGEND; ESRIMAP URL='http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base'; CHOROMAP abc / MAPID=def ID=def DISCRETE; RUN;
Note the order - as long as the ODS GRAPHICS statement is listed below/after the ODS HTML statement, then this works. If it's flipped like I showed in the first code snippet, the code will create a file called 'my_map1.png'.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.