Help using Base SAS procedures

Using a SAS Macro for continuous NRI calculation

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Using a SAS Macro for continuous NRI calculation

Hi everyone,

 

I have a deadline for doing this analysis and would really appreciate some help. 

 

I'm using a data registry where the outcome of interest is complication (var name COMPLIC coded as 1 or 0) and where I have two models---one only uses age (var name NEWAGE) and one uses both age and gender (names NEWAGE and MALESEX).

 

I went to this site (http://ncook.bwh.harvard.edu/sas-macros.html) and downloaded a macro for continuous NRI (file titled reclass.macros.v4.sas", attached). The format of the macro is CONTNRI(DSNAME,DETAIL,STATVAR,PROB1,PROB2) where DSNAME is my data set, Detail (2,1,0 options for level of detail in output), STATVAR is my outcome (COMPLIC), PROB1 is stored probabilities from the first model using only NEWAGE (I used a proc logistic with the following code after the model statement "output out=PROB1 p=phat1" to create data set PROB1 with predicted probabilities phat1 and for the age and sex model used similar to code to create PROB2 with predicted probabilities phat2. The phat1 and phat2 were added as columns to the original dataset and then I submitted the following %CONTNRI(DSNAME,1,COMPLIC,phat1,phat2) where DSNAME is the name of my dataset.

 

SAS generates an output table that is mostly blank and the errors I keep finding in the log are the following: 

 

"ERROR: The LISTING destination is not active; no select/exclude lists are available."

 

And then later on down lower:

 

"WARNING: Output 'Chisq' was not created. Make sure that the output object name, label, or
path is spelled correctly. Also, verify that the appropriate procedure options are
used to produce the requested output object. For example, verify that the NOPRINT
option is not used."

 

"ERROR: The LISTING destination is not active; no select/exclude lists are available.
ERROR: File WORK.CHISQ.DATA does not exist."

 

I have pasted the Macro here. Can anyone please help me figure out what needs to change to make this work? The originators of the MACRO at the link state that the code has been debugged but I can't seem to figure out how to fix the error. 

 

Thank you so much!

 

Aakash

 

Attachment

Accepted Solutions
Solution
‎05-14-2016 12:23 AM
Super User
Posts: 19,768

Re: Using a SAS Macro for continuous NRI calculation

Is HTML your default output? 

You can turn on listing with the following line. Give that a try and see if it works, otherwise you may have to dive into the code to see if there's a bug. I would try the following before your macro invocation and see if that resolves the issue. 

 

ODS LISTING;

View solution in original post


All Replies
Solution
‎05-14-2016 12:23 AM
Super User
Posts: 19,768

Re: Using a SAS Macro for continuous NRI calculation

Is HTML your default output? 

You can turn on listing with the following line. Give that a try and see if it works, otherwise you may have to dive into the code to see if there's a bug. I would try the following before your macro invocation and see if that resolves the issue. 

 

ODS LISTING;
New Contributor
Posts: 3

Re: Using a SAS Macro for continuous NRI calculation

Dear Reeza, 

 

Thank you so much! the output was generated and it works. 

 

Definitely learned something today :-). 

 

Best,

 

Aakash

Super User
Posts: 19,768

Re: Using a SAS Macro for continuous NRI calculation

So I tried the macro and with ODS LISTING on the results are generated. 

 

The code is a bit badly designed by explicitly referencing ODS LISTING for the exclude/select but that's not the end of the world. 

 

Tested using SAS University Edition, sample code below. 

 

proc logistic data=sashelp.heart;
class sex;
model status = sex weight;
output out=test1 p=prob1;
run;quit;

proc logistic data=sashelp.heart;
class sex;
model status = sex weight height;
output out=test2 p=prob2;
run;quit;

data want;
merge test1 test2;
run;


ods listing file='/folders/myfolders/mylist.lst';
%contnri(want,1,status,prob1,prob2);
New Contributor
Posts: 3

Re: Using a SAS Macro for continuous NRI calculation

Thank you!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 606 views
  • 2 likes
  • 2 in conversation