hi, I doing a research which compare basic model with new model. This new model is basic model+ a new biomarker. I have a dichotomous outcome. I want to calculate IDI and NRI to show the added predictive ability of this new marker on the basic model.
I found a paper by Kevin Kennedy A SAS macro to compute added predictive ability of a new marker in logistic regression. I try to used the syntax in the appendix of this paper but the result did not come out. here I post what the log said. it keep saying uninitialized.
what did I do wrong? or could you help me where I could download the macro so that I could just used it instead? I already email Mr Kennedy but still not receive any reply. it would be nice if someone could help me.tx
Hi,
the paper code seems to work with the example provided.
You may have copy/paste issues, try the code I've reindented.
- Cheers -
hi, thank for your replay. I try to use your code. but it seems that I cannot make the data nri1. the output folder for data create nri1 data but it's empty. the log said this.
When SAS reports a variable is uninitialized that means the variable name appears in code but has no values.
Example.
16 data example; 17 x=3; 18 label y ='Some nonexistent values'; 19 run; NOTE: Variable y is uninitialized. NOTE: The data set WORK.EXAMPLE has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.01 seconds
This sort of thing is moderately common when using someone else's code without understanding it. The author likely used different variables at some point than you do but the code still uses the authors variables. But you did not provide any values for those so you get the note.
Macro code can compound this by building variable names dynamically and so you can't just search for the offending text in the program code.
If you are running a macro then you want to set OPTIONS MPRINT; prior to executing the macro so the entire code as generated appears in the log and you can get an idea of what needs to change.
Hi,
As far as I can see, the macros are variable independent and should work with any kind of data, you only need to adapt the model in the call.
You have the macros in the paper and I've extracted and provided them in my previous post. Why aren't you following the examples?
It works with sashelp.cars:
*APPENDIX C: EXAMPLE;
DATA cars;
set sashelp.cars;
msrp_40k=(msrp>40000); /*indicator for car being over $40,000*/
cnt+1;
RUN;
/*Test to see if Country of Origin adds to the prediction of
msrp_40k with engine size, weight, and
MPG_Highway in model
Using NRI groups (<10%, 10-30%, >30%)*/
/*initial model*/
PROC LOGISTIC DATA=cars descending;
model msrp_40k=enginesize weight mpg_highway;
output out=m1 pred=p1;
RUN;
/*new model*/
PROC LOGISTIC DATA=cars descending;
class origin;
model msrp_40k=enginesize weight mpg_highway origin;
output out=m2 pred=p2;
RUN;
PROC SQL;
CREATE table cars2 as SELECT *
FROM m1 as a left join m2 as b on a.cnt=b.cnt;
QUIT;
%add_predictive(DATA=cars2,y=msrp_40k,p_old=p1,p_new=p2, nripoints=.1 .3);
and with sashelp.class:
*APPENDIX C: EXAMPLE;
DATA class;
set sashelp.class;
height_60=(height>60); /*indicator for height over 60*/
cnt+1;
RUN;
PROC LOGISTIC DATA=class descending;
model height_60=weight weight age;
output out=m1 pred=p1;
RUN;
/*new model*/
PROC LOGISTIC DATA=class descending;
class sex;
model height_60=weight age sex;
output out=m2 pred=p2;
RUN;
PROC SQL;
CREATE table class2 as SELECT *
FROM m1 as a left join m2 as b on a.cnt=b.cnt;
QUIT;
%add_predictive(DATA=class2,y=height_60,p_old=p1,p_new=p2, nripoints=.1 .3);
If you still can not fix it you should provide the code you are running together with sample data.
- Cheers -
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.