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

I am using data from PRAMS (which uses a complex survey design) to create an ROC curve using predicted probabilities. How can I see the sensitivity and specificity for my various cutoffs, keeping in mind the complex sample?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The ROC curve IS the set of sensitivities and specificities. I assume when you say, "how can I see them," you mean you want to display the actual numerical values along the curve? If so, you can do this by using ODS OUTPUT.

  1. Find the name of the ROC graph for which you want the values
  2. Use ODS OUTPUT to write the graph to a SAS data set
  3. Use PROC PRINT to display the results

For example, if you were using PROC LOGISTIC, it might look like this:

ods trace on;
proc logistic data=Data1 plots(only)=roc;
   model disease/n=age;
   ods output ROCCurve=OutROC;
run;

data OutROC2;
set OutROC;
Specificity = 1 - _1MSPEC_;
run;

proc print data=OutROC2 label;
var _SENSIT_ _1MSPEC_ Specificity;
run;

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

The ROC curve IS the set of sensitivities and specificities. I assume when you say, "how can I see them," you mean you want to display the actual numerical values along the curve? If so, you can do this by using ODS OUTPUT.

  1. Find the name of the ROC graph for which you want the values
  2. Use ODS OUTPUT to write the graph to a SAS data set
  3. Use PROC PRINT to display the results

For example, if you were using PROC LOGISTIC, it might look like this:

ods trace on;
proc logistic data=Data1 plots(only)=roc;
   model disease/n=age;
   ods output ROCCurve=OutROC;
run;

data OutROC2;
set OutROC;
Specificity = 1 - _1MSPEC_;
run;

proc print data=OutROC2 label;
var _SENSIT_ _1MSPEC_ Specificity;
run;
gabybarber
Calcite | Level 5
Thanks! That was exactly what I was looking for - to display the numerical
values.
gabybarber
Calcite | Level 5

One follow up question - I am trying to get the sensitivity and specificity for each of my exposure groups independent of the covariates I have included in the model. For example, my exposure variable is smoking (4 levels), and I have included the covariate sex in my model (2 levels). Right now, I get sensitivities and specificities for each combination of the smoking groups and sex (8 different sensitivities). I would just like to see sensitivity and specificity for each level of the exposure group (smoking), independent of sex. 

Rick_SAS
SAS Super FREQ

Then remove SEX from your model.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1003 views
  • 2 likes
  • 2 in conversation