Hello all,
I have a dataset including 4 columns as (TP, TN, FP, and FN), which means the researcher identified these metrics based on their clinical knowledge. Based on this, I can calculate sen, spe, PPV, NPV, accuracy, etc directly using the code below:
proc sql;
create table tmp1 as select
sum(TP) as TP, sum(TN) as TN, sum(FP) as FP,
sum(FN) as FN, sum(tntp) as tntp, sum(fnfp) as fnfp
from tmp; quit;
proc sql;
create table tmp2 as select
TP/(TP+FN) as sensitivity, TN/(TN+FP)as specificity,
TP/(TP+FP) as PPV, TN / (TN+FN) as NPV, (tn+tp)/(tn+tp+fn+fp) as accuracy
from tmp1; quit;
I think there is another way to get these metrics using proc freq, but not sure how to sort out as I don't have the column as an actual values to include "actual*predicted" in proc freq.
Could you please help me to figure out what is the SAS code to get the Confidence Interval for all the metrics, sen, spe, PPV,NPV, accuracy, etc
Thank you!
Those are the 4 cell count values used to create the FatComp data set in this note which illustrates, in various ways, how those and other statistics can be computed. So, you could use the same approach to create a data set with your cell counts and then use the SENSPEC option in PROC FREQ, as shown, to compute four of the statistics you want. Those statistics, and all of the other ones discussed in the note (including accuracy) can be computed as shown using PROC NLMIXED. Yet another method for computing accuracy is also shown.
Thank you for your answer, I am familiar with this note, my issue is as I have four columns like below, I am not sure how to sort it out in proc freq
TP TN FP FN
1 . . .
. 1 . .
. . . 1
.
.
. 1 . .
in FatComp data set there are only "test and response" column
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!
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.