BookmarkSubscribeRSS Feed
MaryA_Marion
Lapis Lazuli | Level 10

I am running proc logistic with selection = stepwise on the model statement.

Before running this procedure I'm running code to exclude some of the output. I'm finding that in the case of selection equal stepwise that exclusion is not working. I have checked the ods output using ODS trace on. I can't include more details because of the sensitivity of this data but wonder if you can provide any helpful information. I'm finding the exclude feature to be very helpful. The code and a portion of the log I'm using is given below.

ods trace on;
ods graphics on;
ods exclude 
Nobs
where = (_path_ ? 'Step0') 
where = (_path_ ? 'Step1')
where = (_path_ ? 'Step2')
ROCCurve
LackFitPartition
influence
influencePlots.'Panel 2'
CalibrationPlot
;

A portion of the log (stepwise selection) is given below.

Output Added:
 -------------
 Name:       ROCCurve
 Label:      ROC Curve for Selected Model
 Template:   Stat.Logistic.Graphics.ROC
 Path:       Logistic.ROCCurve
 -------------
 
 Output Added:
 -------------
 Name:       ROCOverlay
 Label:      ROC Curve for All Steps
 Template:   Stat.Logistic.Graphics.ROCOverlay
 Path:       Logistic.ROCOverlay
 -------------
 
 Output Added:
 -------------
 Name:       LackFitPartition
 Label:      Partition
 Template:   Stat.Logistic.LackFitPartition
 Path:       Logistic.LackFit.LackFitPartition
 -------------
 
 Output Added:
 -------------
 Name:       LackFitChiSq
 Label:      Chi-Square Test
 Template:   Stat.Logistic.LackFitChiSq
 Path:       Logistic.LackFit.LackFitChiSq
 -------------
 
 Output Added:
 -------------
 Name:       Influence
 Label:      Influence
 Template:   Stat.Logistic.Influence
 Path:       Logistic.Influence
 -------------
 
 Output Added:
 -------------
 Name:       InfluencePlots
 Label:      Panel 1
 Template:   Stat.Logistic.Graphics.InfluencePanel
 Path:       Logistic.InfluencePlots.InfluencePlots
 -------------
 
 Output Added:
 -------------
 Name:       InfluencePlots
 Label:      Panel 2
 Template:   Stat.Logistic.Graphics.InfluencePanel
 Path:       Logistic.InfluencePlots.InfluencePlots
 -------------
 
 Output Added:
 -------------
 Name:       CalibrationPlot
 Label:      Calibration Plot
 Template:   Stat.Logistic.Graphics.CalibrationPlot
 Path:       Logistic.CalibrationPlot
 -------------

By the way, a rather obvious solution is to run the final model separately. I've been at this place before and I'm just a little stubborn about being able to do it in just one run. Thank you.

Sincerely,
Mary A. Marion

 

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @MaryA_Marion,

 

I don't know why outputs such as ROCCurve and LackFitPartition, which you have explicitly excluded, would appear in the output. The first thing to check is, of course, the log: Did your ODS EXCLUDE statement run immediately before the PROC LOGISTIC step and there are no errors, warnings or suspicious notes in the log?

 

The second step, if needed, would be to close the SAS session and run the code in a new session. Do the excluded parts of the output still occur? What does ods show; (cf. documentation) write to the log if you insert it between the ODS EXCLUDE statement and the PROC LOGISTIC step?

 

Third, you could run an example from the documentation. I took your ODS EXCLUDE statement, followed by the code from Example 78.1 Stepwise Logistic Regression and Predicted Values and did not get Nobs, LackFitPartition, etc. -- as expected.

 

In principle, you could switch from ODS EXCLUDE to ODS SELECT and specify the outputs you do want instead of an exclusion list. But I'd rather use ods exclude all; (or, equivalently: ods select none;), which should suppress printed output entirely, and then add ODS OUTPUT statements and/or options (such as OUTEST=) of the PROC LOGISTIC statement to write all tabular output of interest to SAS datasets. Creating customized tables (using, e.g., PROC REPORT) based on such datasets is a common technique in many practical applications I've seen. Thus you have much better control (than with ODS EXCLUDE/SELECT) over what is displayed and how. The "raw" procedure output would be put into an appendix of the report, if used at all. The only exception to this strategy might be the plots. But most of the selected/not excluded graphs are written to separate PNG files (using ods listing; see also the UNPACK option of the PLOTS option) and it should be easy to delete files that are not needed.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 985 views
  • 1 like
  • 2 in conversation