BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nagi
Fluorite | Level 6
Hello, I am a beginner of SAS and I am struggling with AUC comparison between 2 different model.
 
In SAS, I can compare AUC between the nested(hierarchical) models using ROCCONTRAST. But, how about the different models like the following two logistic regression models?
 
1 . where sex = 0;
     model cvd = bmi;
 
2.  where sex = 1;
     model cvd = bmi;   
 
The have the same independent variable but under different condition.
Is it possible to compare and test the difference in that case?
 
Thanks in advance,
 
Nagi
1 ACCEPTED SOLUTION

Accepted Solutions
Nagi
Fluorite | Level 6

Thank you for your reply!

 

I could solve this problem. I appreciate your help.

 

Nagi

View solution in original post

4 REPLIES 4
Ksharp
Super User

Check the last curve .

 

data F;
 set sashelp.class(where=(sex='F'));
 y=ifn(_n_>4,1,0);
run;
data M;
 set sashelp.class(where=(sex='M'));
 y=ifn(_n_>4,1,0);
run;


data test;
 set sashelp.class;
 y=ifn(_n_<4,1,0);
 if _n_<10;
run;
data test_f;
 set f test(drop=y);
run;
data test_m;
 set m test(drop=y);
run;



proc logistic  data=test_f;
model y=age weight height;
output out=pred_f(where=(y is missing)) p=pred_f;
run;
proc logistic  data=test_m;
model y=age weight height;
output out=pred_m(where=(y is missing)) p=pred_m;
run;


data want;
 merge test(keep=y) 
 pred_f(keep=pred_f)  pred_m(keep=pred_m);
run;
proc logistic data=want;
model y=pred_f pred_m/nofit;
roc 'F' pred=pred_f ;
roc 'M' pred=pred_m;
run;



Nagi
Fluorite | Level 6
Thank you for your reply.

In IFN function, what does "_n_>4" mean?

Thanks in advance,

Nagi

Ksharp
Super User

I just made some dummy Y . i.e. the first 4 obs have y=1 ,others have y=0 .

Nagi
Fluorite | Level 6

Thank you for your reply!

 

I could solve this problem. I appreciate your help.

 

Nagi

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1995 views
  • 0 likes
  • 2 in conversation