BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sms1891
Quartz | Level 8

Hi SAS experts,

I have a data set with  N= 2196 observations, variables PIPE1, PIPE2, PIPE3, PIPE4, PIPE5, PIPE6, PIPE_Score,  PIIE_Triage and an outcome variable (Outcome, values 0 for No and 1 for Yes). I need help with calculating the sensitivity and specificity for predicting the outcome based on the PIPE1 using a bootstrapping data.  I calculated the sensitivity and specificity for the original data set but I need help with calculating the  sensitivity and specificity for the bootstrapped dataset. How can I achieve this? Any help with this is much appreciated.

 

Thank you so much in advance!

SM

PROC IMPORT OUT= WORK.Flu
            DATAFILE= "\\Desktop\Flu.xlsx" 
            DBMS=EXCEL REPLACE;
     RANGE="Sheet1$"; 
     GETNAMES=YES;
     MIXED=NO;
     SCANTEXT=YES;
     USEDATE=YES;
     SCANTIME=YES;
RUN;



 proc freq data=Flu order=data;
 tables Pipe1*Outcome / senspec;
 run;
 *Bootstrapping;
proc surveyselect data=flu NOPRINT seed=123456
out=fluBootout
method=urs 
samprate=1
reps=1000;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

On top of the below program, please also take a look at :
https://blogs.sas.com/content/tag/bootstrap-and-resampling/

 

Here's the program (I have made my own dataset "Flu" in the first line of code) :
And maybe you want to reconsider your choice of "1" for samprate. 

The procedure treats the value 1 as 100% instead of 1%.
If you want 1%, use 
SAMPRATE=0.01 .

 

data Flu; set sashelp.class; Pipe1=Sex; Outcome=Sex; run;

proc freq data=Flu order=data;
 tables Pipe1*Outcome / senspec;
run;

*Bootstrapping;
proc surveyselect data=Flu NOPRINT seed=123456
                   out=fluBootout
 method=urs 
 samprate=1
 reps=1000;
run;

ods trace off;
ods exclude CrossTabFreqs; 
ods output SenSpec=work.SenSpec;
proc freq data=fluBootout order=data;
 by Replicate;
 weight NumberHits;
 tables Pipe1*Outcome / senspec;
run;

title; footnote;

title 'Bootstrapped Sensitivity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
 where Statistic='Sensitivity';
 var Estimate;
run;

title 'Bootstrapped Specificity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
 where Statistic='Specificity';
 var Estimate;
run;

title; footnote;
/* end of program */

Koen

View solution in original post

3 REPLIES 3
sbxkoenk
SAS Super FREQ

On top of the below program, please also take a look at :
https://blogs.sas.com/content/tag/bootstrap-and-resampling/

 

Here's the program (I have made my own dataset "Flu" in the first line of code) :
And maybe you want to reconsider your choice of "1" for samprate. 

The procedure treats the value 1 as 100% instead of 1%.
If you want 1%, use 
SAMPRATE=0.01 .

 

data Flu; set sashelp.class; Pipe1=Sex; Outcome=Sex; run;

proc freq data=Flu order=data;
 tables Pipe1*Outcome / senspec;
run;

*Bootstrapping;
proc surveyselect data=Flu NOPRINT seed=123456
                   out=fluBootout
 method=urs 
 samprate=1
 reps=1000;
run;

ods trace off;
ods exclude CrossTabFreqs; 
ods output SenSpec=work.SenSpec;
proc freq data=fluBootout order=data;
 by Replicate;
 weight NumberHits;
 tables Pipe1*Outcome / senspec;
run;

title; footnote;

title 'Bootstrapped Sensitivity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
 where Statistic='Sensitivity';
 var Estimate;
run;

title 'Bootstrapped Specificity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
 where Statistic='Specificity';
 var Estimate;
run;

title; footnote;
/* end of program */

Koen

sms1891
Quartz | Level 8
Can we get the 95% CIs for the bootstrapped sensitivity and specificity?
sbxkoenk
SAS Super FREQ

@sms1891 wrote:
Can we get the 95% CIs for the bootstrapped sensitivity and specificity?

Of course, you can!

Look here and you will find out how to do so ...

    Compute a bootstrap confidence interval in SAS
    By Rick Wicklin on The DO Loop August 10, 2016

https://blogs.sas.com/content/iml/2016/08/10/bootstrap-confidence-interval-sas.html

 

Koen

 

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!

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