BookmarkSubscribeRSS Feed
EricCai
Calcite | Level 5

Dear Community,

I have a macro that successfully creates 2x2 contingency tables, one for each value of a variable X.  The contingency tables are created from PROC FREQ.

Now, I would like to

1) calculate the specificity and sensitivity from each table

2) plot all pairs of sensitivity and 1-specificity to create an ROC curve (sensitivity vs. 1-specificity) for all values of X

Is there a way to automate this in SAS?  I can't find a way to do so via searching on Google or SAS documentation.

I envision the successful macro being able to

a) extract the counts from each cell in each contingency table

b) calculate sensitivity and 1-specificity for each contingency table

c) plot sensitivity vs. 1-specificity

but I can't figure out how to do this.  (I'm sure that DO-loops and arrays are needed somehow.)

Thus, right now, I am typing the counts by hand into Microsoft Excel and plotting the ROC curve there.  This worked initially when I only had to create 5 ROC curves, but I now need to produce 20, and I wish to automate this process.                            

Any help that you can provide would be much appreciated!

Thanks,

Eric

1 REPLY 1
Cynthia_sas
SAS Super FREQ


Hi:

  You might post this in the SAS/Graph and ODS Graphics forum. This paper/presentation, for example, shows a method using the SG procedures from data that seems to be generated with PROC FREQ

(http://www.phuse.eu/download.aspx?type=cms&docID=4192).

cynthia

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
  • 1 reply
  • 1060 views
  • 0 likes
  • 2 in conversation