I addressed the issue of more than one active ODS destinations in the following code ... and it appears to work 'great' in both 9.2 and 9.3 (the 1st two statements are just to set things up for testing on both versions): ods listing; ods html; %MACRO test; /* Save all current system used in the macro for later re-setting to original state GOPTIONS that are set in the macro are reset to the default system values only */ %let sopts= %sysfunc(getoption(missing,keyword)) %sysfunc(getoption(center)) %sysfunc(getoption(xwait)) %sysfunc(getoption(xsync)) %sysfunc(getoption(date)) %sysfunc(getoption(papersize,keyword)) %sysfunc(getoption(bottommargin,keyword)) %sysfunc(getoption(topmargin,keyword)) %sysfunc(getoption(rightmargin,keyword)) %sysfunc(getoption(leftmargin,keyword)) %sysfunc(getoption(orientation,keyword)) ; OPTIONS MPRINT; /* Following launch of PROC TEMPLATE is to 'force' SASHELP.VDEST to have observations (if SAS just initialized it would not have any values */ proc template; run; data _null_; set sashelp.vdest end=last; call symput('INIT_DEST'||left(_n_),destination); call symput('INIT_STYL'||left(_n_),style); if last then call symput('N_DEST',LEFT(_n_)); else; run; %do I = 1 %to &N_DEST %by 1; ODS &&INIT_DEST&I CLOSE; %end; options noxwait xsync; ods rtf file='test.rtf'; ods results off; /* PUT CODE FOR MACRO HERE ... THAT VARIOUSLY USES A VARIETY OF ODS DESTINATIONS */ ODS _ALL_ CLOSE; /* Reset system options, etc. to starting values and goptions to system default values */ OPTIONS &SOPTS; GOPTIONS reset=goptions; /* Reset ODS destinations to original values */ %do I = 1 %to &N_DEST %by 1; ODS &&INIT_DEST&I style=&&INIT_STYL&I; %end; ODS RESULTS ON; %MEND test; %TEST
... View more