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;
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
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.
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.
ballardw wrote:
However you arrange your ODS destinations at least one must be open when output is generated.
No it doesn't...
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.
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
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
Hi,
I suggest you changing
if cnty_name in ('county1', 'County2');
to
if upcase(cnty_name) in ('COUNTY1', 'COUNTY2');
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.