Using SAS 9.4
I am trying to get the sensitivity, specificity, PPV, NPV as well as the 95% CI for each. I tried running a proc freq with the senspec option but I must not be running the correct version of SAS for this option to be available. My question is if their is another efficient way to get the sensitivity, specificity, PPV, NPV as well as the 95% CI using SAS? Thank you
Data:
data have;
infile datalines delimiter=',';
input A $ B $;
datalines;
Negative, A
Negative, A
Negative, A
Negative, A
Negative, A
Negative, A
Negative, B
Negative, B
Positive,B
Positive,B
Positive,B
Positive,B
Positive,C
Positive,C
Positive,C
Positive,C
Positive,C
;
Code:
proc freq data = check;
table A*B /senspec;
where B not in: ('C');
run;
Error:
ERROR 22-322: Syntax error, expecting one of the following: ;, AGREE, ALL, ALPHA, BDT, BIN,
BINOMIAL, CELLCHI2, CHISQ, CL, CMH, CMH1, CMH2, COMMONRISKDIFF, COMONMRDIFF,
CONTENTS, CONVERGE, CROSSLIST, CUMCOL, DEVIATION, EXACT, EXPECTED, FISHER, FORMAT,
GAILSIMON, GS, JT, KAPPA, LINE, LIST, MAXITER, MAXLEVELS, MEASURES, MISSING,
MISSPRINT, NOCOL, NOCUM, NOFREQ, NOPERCENT, NOPRINT, NOROW, NOSPARSE, NOWARN,
ODDSRATIO, OR, OUT, OUTCUM, OUTEXPECT, OUTPCT, PEARSONRES, PEARSONRESID, PLCORR,
PLOTS, PRINTKWTS, PRINTWTS, RELRISK, RISKDIFF, SCORE, SCORES, SCOROUT, SPARSE,
STDRES, STDRESID, TABLE, TESTF, TESTP, TOTPCT, TREND, WARN.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
Version 9.4
That link is the post I was looking at and hoping to get a similar output
9.4 M what?
Otherwise, I think you're essentially stuck doing it manually. If you search on lexjansen.com you'll find some macros and example code, but ultimately it's a manual calculation. The code at the bottom of the post (multiple proc freqs) shows how to calculate each value manually, without the option.
title 'Sensitivity/TPR/Recall'; proc freq data=FatComp; where Response=1; weight Count; tables Test / binomial(level="1"); exact binomial; run; title 'Specificity/TNR'; proc freq data=FatComp; where Response=0; weight Count; tables Test / binomial(level="0"); exact binomial; run; title 'Positive predictive value/Precision'; proc freq data=FatComp; where Test=1; weight Count; tables Response / binomial(level="1"); exact binomial; run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.