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

In PROC LOGISTIC (v.9.4) with SELECTION=STEPWISE, if you ask to output the ROC curve data (OUTROC), you get results for every step.  My question: Is there a way to restrict the output to just the final step?  Failing that, is there a way that I can use ODS to output the total number of steps so that I can subset the OUTROC dataset?  [I suppose I could use proc freq to find the maximum number of steps and then try to pass that maximum number to a DATA step.  But that's very kludgy.]

 

My current code:

proc logistic data=hem;
model outcome(ref='Alive') = IL_1ra IL_6 IL_8 IL_10 Eotaxin IP_10 MCP_1 / outroc=hem selection=stepwise;
output out=outhem predicted=predhem xbeta=xbhem;
run;

 

Thanks,

Dennis Hanseman

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

@oakHILLS68 wrote:

(...) is there a way that I can use ODS to output the total number of steps so that I can subset the OUTROC dataset?  [I suppose I could use proc freq to find the maximum number of steps and then try to pass that maximum number to a DATA step.  But that's very kludgy.]


Hello @oakHILLS68,

 

You can do the selection in one DATA step;

data want(drop=_s);
if _n_=1 then set hem(rename=(_step_=_s)) point=n;
set hem nobs=n;
if _step_=_s;
run;

View solution in original post

5 REPLIES 5
Reeza
Super User
If you're just interested in the final results, why not just use the final model and remove the selection option entirely?
oakHILLS68
Fluorite | Level 6
That's a good idea, but my code is in a macro. I need to run it multiple times with different macro parameters.

Thanks.
Reeza
Super User
So pipe the selected variables from the previous logistic regression to the next step using macro variables.
FreelanceReinh
Jade | Level 19

@oakHILLS68 wrote:

(...) is there a way that I can use ODS to output the total number of steps so that I can subset the OUTROC dataset?  [I suppose I could use proc freq to find the maximum number of steps and then try to pass that maximum number to a DATA step.  But that's very kludgy.]


Hello @oakHILLS68,

 

You can do the selection in one DATA step;

data want(drop=_s);
if _n_=1 then set hem(rename=(_step_=_s)) point=n;
set hem nobs=n;
if _step_=_s;
run;

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 965 views
  • 2 likes
  • 3 in conversation