BookmarkSubscribeRSS Feed
CaraJ
Calcite | Level 5

Hi Everyone, I am interested in learning how to write up SAS code to calculate sensitivity and specificity in my confusion matrix (5X5 table) below. Any help would be greatly appreciated Smiley Happy.

                                                                                Program

Syndrome                  Diarrheal-toxin          EC           Salmonella           Viral             Vomiting-toxin

Diarrheal-toxin                 50                         1                   0                    2                       0

EC                                  0                         25                  8                    0                       0

Salmonella                      1                         20                252                  6                        1

Viral                                4                         0                    0                   786                    39

Vomiting-toxin                  2                        0                     0                   0                        41

Thank you in advance


4 REPLIES 4
Reeza
Super User

How are you defining specificity and sensitivity in your particular case?

CaraJ
Calcite | Level 5

Hi Reeza, sorry I am defining mine as those syndrome outbreaks that are correctly classified in their respective program. For example, I calculate the sensitivity of diarrheal-toxin manually to be 94.3% (50/53).

Reeza
Super User

I don't recall specificity either (and don't feel like looking it up) but the general idea for sensitivity is simple enough.

data want;

set have;

array cause(5) diarrheal ec salmonella viral vomit;

total=sum(of cause(*));

sensitivity=cause(_N_)/total;

run;

CaraJ
Calcite | Level 5

Thank you sorry. I should have fully place the definitions up-my apologies but specificity is the probability of the syndromal outbreaks negative for a particular program given that it is not correctly classifed.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1400 views
  • 0 likes
  • 2 in conversation