BookmarkSubscribeRSS Feed
Olivier
Pyrite | Level 9
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.
Olivier

PS : sorry if it's a silly question with a very simple answer, but I have not found any for the moment.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Olivier:
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 listing;
ods html file='foobar.html';
ods LISTING select variables;
ODS HTML select variables;

ODS HTML SHOW ;
ODS LISTING SHOW ;

proc contents data=sashelp.class;
run;

ods HTML select BasicMeasures;
ODS HTML SHOW;

proc univariate data=sashelp.class;
var height;
run;
ods html close;
ods listing close;

ODS LISTING SHOW;
ODS RTF SHOW;
ODS PDF SHOW;
ODS HTML SHOW;
[/pre]

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
ODS LISTING;
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)
ODS LISTING;
in order to immediately reopen the LISTING destination.
cynthia
David_SAS
SAS Employee
This is an oft-requested feature. It has been implemented in the upcoming SAS 9.2 release. Simply query SASHELP.VDEST, e.g.:
[pre]
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
[/pre]
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.

-- David Kelley, SAS
Olivier
Pyrite | Level 9
Thank you David for the good news. This looks very simple, easy to use, efficient.
I'm really looking forward to work on 9.2 !

Cynthia, thank you for the reminder on ODS SHOW. There was no allusion to proc Report in your example ?! I thought you ALWAYS managed to put some Report in any example on any given subject 🙂

Olivier

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
  • 3 replies
  • 2454 views
  • 3 likes
  • 3 in conversation