- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a data set where one real outcome variable (binary variable 0 or 1) and the model predicted binary variable (0 or 1).
But I have 60 number of the model predicted binary variable in the data set, which means I need to create the 2*2 table with the actual outcome and each of the model predicted variable to compute the sensitivity, specificity, and youden's index.
Here is the screen shot of my data. In the below data set, allfrc is my real outcome variable and lnn_naa1, lnn_naa2,....., are my model predicted outcome.
I used the following command to compute the sensitivity and sensitivity.
proc sort data=mydata out=dataout;
by descending lnn_naa1 descending allfrc;
run;
proc freq data = dataout order=data;
table lnn_naa1*allfrc / senspec ;
test kappa;
run;
My questions are as below.
1) I created this as macro and run with each model predicted outcome variable (for example, lnn_naa1 * allfrc, and then lnn_naa2*allfrc). But this way takes a lot of time to run.
2) Any recommendation to run the actual outcome * model predicted outcome with calculating the sensitivity, specificity and youden's index?
Thank you for any help and comments!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use parentheses to group variables, or variable lists for use on a tables statement in proc freq.
Try
tables ( inn: )* allfrc / senspec;
Which should use all. of the variables whose names start with INN agains allfrc. If you need other variables
tables ( inn: )* (allfrc othervar somevar) / senspec;
would cross all of the inn vars against the three in parentheses.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are going to run a proc freq many times on one table, try loading it in memory use SASFILE beforehand to speed up reading the data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ChrisNZ ,
Thank you for your comment.
I will try to look at the SASFILE to use in the memory. I'm kind of stuck that I need to sort first before I create the 2*2 table and then I do proc freq.
I don't know how to make the out of sort file in the macro for each my model predicted outcome. Do you know how can I compute the sensitivty, specificity, and youden's index from proc freq table output? I have output of sensitivity and specificity from the table, not the youden's index.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure you need to sort? Sorting is normally needed only when using a BY statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I do sorting always whenever I create the 2*2 table to look at the sensitivity and specificity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use parentheses to group variables, or variable lists for use on a tables statement in proc freq.
Try
tables ( inn: )* allfrc / senspec;
Which should use all. of the variables whose names start with INN agains allfrc. If you need other variables
tables ( inn: )* (allfrc othervar somevar) / senspec;
would cross all of the inn vars against the three in parentheses.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ballardw
Thank you for your suggestion.
Yes, it is giving me all the frequency table with the (inn:). (I knew this techniques, but I never think about this, thank you for your response!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A quick google search on SAS Youden index yields: https://www.pharmasug.org/proceedings/2016/SP/PharmaSUG-2016-SP11.pdf
And others.