BookmarkSubscribeRSS Feed
dr2014
Quartz | Level 8

Hi ,

I have been using the the following ods statement to output a histogram using proc sgplot. This code is contained within a macro which is placed  in another large macro and is activated when certain conditions are met...i.e:

%macro example;

----------------------------------

-------------------------------

ods listing gpath = "&out." ;   /

/* create PNG image file */

ods graphics on / reset=index imagename = "histogram" ;

proc sgplot data=out.&summary.;

histogram xyz;

xaxis thresholdmin=1  thresholdmax=1;

run;

%mend example;

Within the larger code there is a statement that says:

%macro largemacro;

several sas codes--------------------

-------------------

-------------------

if a in (1,2,3) then %example;

ods_all_close;

%mend largemacro;

I ran it for different examples of data and this is the first time I noticed this problem. I am able to get the dataset '&summary' and it has the variable xyz in it. I also tried removing the ods_all_close statement but it still doesn't work. I don't think the ods_all_close statement affects ods grahics ( It was placed to ensure all output destinations are closed for subsequent program runs ). There are several such ods_all_close statement in the entire code. As I mentioned it works for other examples. I would appreciate your help. Thanks !

1 REPLY 1
ballardw
Super User

Your %example macro is inheriting which ever ODS destination(s) is open. If none are open at the time it is called you'll get this message.

If your largemacro is calling other macros that would be a likely place to look for an ill placed _all_ close.

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
  • 1 reply
  • 1294 views
  • 0 likes
  • 2 in conversation