BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Paul_NYS
Obsidian | Level 7

Hi

In the below code, do I need to close ODS (ods listing close;) after the first proc lifetest and prior to the second proc lifetest steps?

Paul

proc lifetest data=s10;

  ods select Quartiles;

  ods output Quartiles=annual;

  time dur_filing_issuejoin*censor_filing_issue(1);

  strata cnty_name filingYear;

run;

data s10ERT;

set work.s10;

if cnty_name in ('county1', 'County2');

run;

proc lifetest data=s10ERT;

  ods select Quartiles;

  ods output Quartiles=annualnyc;

  time dur_filing_issuejoin*censor_filing_issue(1);

  strata filingYear;

run;

ods listing close;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  You're both right. Some procedures MUST have at least one destination open in order to produce results. The report procedures and graph procedures generally fall in this category. For ODS OUTPUT, it is a destination (just not a report destination), so even if you close LISTING, ODS OUTPUT is a valid destination for creation of an output dataset.

cynthia

View solution in original post

7 REPLIES 7
Reeza
Super User

What are you trying to do?

Suppress all output to the listing tables?

You can use ods listing close before both or ods noresults before both.

You can also use the where clause in proc lifetest, you don't need to create that second dataset.

ballardw
Super User

A generic ODS sandwich to prevent output going to listing but to your desired ods destination looks like:

ods listing close;

ods <output type> <options>;

/* procedures and output generators here*/

ods <output type> close;

ods listing ;

This sends all of the output between the ODS output destination statements to a single file. If you need to redirect to another output destination put the new ODS output destination in the middle but you dont' need to repeat the listing close.

However you arrange your ODS destinations at least one must be open when output is generated.

Reeza
Super User

ballardw wrote:

However you arrange your ODS destinations at least one must be open when output is generated.

No it doesn't...

ballardw
Super User

In 9.2 here's what happens when attempting to print with all destinations closed:

 

1 ods _all_ close;

2

3 proc print data=sashelp.class; run;

WARNING: No output destinations active.

NOTE: PROCEDURE PRINT used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

And no output generated. ODS output seems to require and ODS destination.

Reeza
Super User

But if you're trying to capture tables it works fine:

21   ods _all_ close;

22   proc means data=sashelp.class;

23   var height weight;

24   ods output summary=summary1;

25   run;

NOTE: The data set WORK.SUMMARY1 has 1 observations and 12 variables.

NOTE: There were 19 observations read from the data set SASHELP.CLASS.

NOTE: PROCEDURE MEANS used (Total process time):

      real time           0.01 seconds

      cpu time            0.00 seconds

Cynthia_sas
SAS Super FREQ

Hi:

  You're both right. Some procedures MUST have at least one destination open in order to produce results. The report procedures and graph procedures generally fall in this category. For ODS OUTPUT, it is a destination (just not a report destination), so even if you close LISTING, ODS OUTPUT is a valid destination for creation of an output dataset.

cynthia

Linlin
Lapis Lazuli | Level 10

Hi,

I suggest you changing

if cnty_name in ('county1', 'County2');

to

if upcase(cnty_name) in ('COUNTY1', 'COUNTY2');

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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