BookmarkSubscribeRSS Feed
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

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.

6 REPLIES 6
Reeza
Super User
What version of SAS do you have?
You can check with proc product_status;run;
The answer will be in the log.

Otherwise, see this post:
https://support.sas.com/kb/24/170.html
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Version 9.4

 

That link is the post I was looking at and hoping to get a similar output

Reeza
Super User

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;
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
M5
StatDave
SAS Super FREQ
There have been many 9.4 releases, so "9.4" is not a sufficient designation. If you run this statement, you will get the correct release designation: %put Release: &sysvlong;
You can ignore the part starting with "P". As mentioned in Note 24170 mentioned below, you need SAS 9.4 TS1M6 to have access to the SENSPEC option. See the people at your site that maintain your SAS license to see if you can upgrade to a more current release.
GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
I missed that part. Thank you for the help

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 1658 views
  • 4 likes
  • 3 in conversation