Hi all !
I was just wondering (in fact I don't currently have the need for it, but just in case) if you can check which ODS destinations are currently open in a SAS program ? Some automatic macro-variable ? A well-hiden function ? Special kung-fu tricks from old chaolin masters ?
Whatever answer will suit me.
Thanks in advance.
PS : sorry if it's a silly question with a very simple answer, but I have not found any for the moment.
I am not aware of a super-secret macro variable, as nice as that might be. ;-)
However, one fact of ODS that may not be as well known as others is that ODS keeps track of selection and exclusion lists for all open destinations. Selection and exclusion lists are those lists of output objects that you can select for a destination. Let's say for example that you are running a PROC CONTENTS and a PROC UNIVARIATE and you want JUST the VARIABLES list from PROC CONTENTS to go LISTING and HTML, and you want BASICMEASURES to go to HTML. You can do this: [pre]
ods html file='foobar.html';
ods LISTING select variables;
ODS HTML select variables;
ODS HTML SHOW ;
ODS LISTING SHOW ;
proc contents data=sashelp.class;
ods HTML select BasicMeasures;
ODS HTML SHOW;
proc univariate data=sashelp.class;
ods html close;
ods listing close;
ODS LISTING SHOW;
ODS RTF SHOW;
ODS PDF SHOW;
ODS HTML SHOW;
The purpose of ODS SHOW is to show you the state of the selection/exclusion list for a ALL destinations or particular destinations. As you can see from the ERROR messages that you get after you issue ODS LISTING CLOSE; you could construct a macro that would "test" which destination was open if you needed to.
The thing is that if you get into the habit of issuing ODS LISTING CLOSE; only when you need to close the LISTING window and then ALWAYS issue an
for every close, then when you start a program, the LISTING destination should be OPEN.
Another thing that I do, when I have multiple destinations open is to issue:
ODS _ALL_ CLOSE; (to close everything)
in order to immediately reopen the LISTING destination.
This is an oft-requested feature. It has been implemented in the upcoming SAS 9.2 release. Simply query SASHELP.VDEST, e.g.:
proc print data=sashelp.vdest;run;
Obs destination style
1 LISTING Listing
2 HTML Default
3 RTF Rtf
NOTE: There were 3 observations read from the data set SASHELP.VDEST.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
Note that there's a Listing style named ... well ... Listing. That was added in support of ODS graphics, which is another new SAS 9.2 feature.