BookmarkSubscribeRSS Feed
suze152
Calcite | Level 5

Hello SAS friends,

 

Please bear with me, I am a coding beginner and am not qualified to invoke macros. I use SAS Studio, University Edition.

 

I have a categorical response variable with 4 levels (DENV_CNTL2, levels 1, 3, 4, 5).
I have a continuous predictor variable (RBP4_ADJC).

Additional predictor variables include (Age, continuous; Sex, binary; Fever, binary).

I would like to run a multinomial logistic regression first with only 1 continuous predictor variable. I would like to run subsequent models with the additional predictor variables (categorical and continuous).

I have read that it's possible to estimate relative risk with PROC LOGISTIC using the %NLEstimate macro. I am having trouble writing the f or fdata parameters of this macro based on my variables. I have also never used a macro.

The code is below, and the output is attached.

PROC LOGISTIC DATA=Suze.ECData;
CLASS DENV_CNTL2 (ref = 1) / param = ref;
MODEL DENV_CNTL2=RBP4_ADJC / RL link=glogit;
STORE OUT=NLE;
RUN;

%NLEstimate(INSTORE=NLE, f=..... ???)

 

Thank you kindly!

 

Suze

2 REPLIES 2
Reeza
Super User

If something is new, find a fully worked example, ensure you can replicate the results and then try and apply it to your data. 

Here’s the one for what you’re looking for. 

http://support.sas.com/kb/57/798.html

 

Calling a macro is the same as using a function in Excel. You put the right things in the function and you get results. 

Learning to use one is very straightforward, writing them is a different story. There no qualifications required to run macros besides a willingness to try it. 

 


@suze152 wrote:

Hello SAS friends,

 

Please bear with me, I am a coding beginner and am not qualified to invoke macros. I use SAS Studio, University Edition.

 

I have a categorical response variable with 4 levels (DENV_CNTL2, levels 1, 3, 4, 5).
I have a continuous predictor variable (RBP4_ADJC).

Additional predictor variables include (Age, continuous; Sex, binary; Fever, binary).

I would like to run a multinomial logistic regression first with only 1 continuous predictor variable. I would like to run subsequent models with the additional predictor variables (categorical and continuous).

I have read that it's possible to estimate relative risk with PROC LOGISTIC using the %NLEstimate macro. I am having trouble writing the f or fdata parameters of this macro based on my variables. I have also never used a macro.

The code is below, and the output is attached.

PROC LOGISTIC DATA=Suze.ECData;
CLASS DENV_CNTL2 (ref = 1) / param = ref;
MODEL DENV_CNTL2=RBP4_ADJC / RL link=glogit;
STORE OUT=NLE;
RUN;

%NLEstimate(INSTORE=NLE, f=..... ???)

 

Thank you kindly!

 

Suze


 

suze152
Calcite | Level 5

Dear Reeza,

 

Thank you for your reply and helpful link. I have been following your suggested link and the example in the "Using PROC LOGISTIC and the NLEstimate macro" section.

I have not been able to find an example using a continuous predictor variable. How will a continuous predictor variable change the application of the NLEstimate macro?

I would like some guidance on how to write the datalines for the data set specified in the fdata=fd NLEstimate macro parameter. Please see the "shownames" in the screenshot attached. 

I am also unsure of my degrees of freedom parameter in the NLEstimate macro.

 

data fd;
length label f $32767;
infile datalines delimiter='|';
input label f;
datalines;
P(3)/P(1)| exp(b_p1+b_p4)
P(4)/P(1)| exp(b_p2+b_p5)
P(5)/P(1)| exp(b_p3+b_p6)
P(3)/P(4)| exp(b_p1+b_p4-b_p2-b_p5)
P(3)/P(5)| exp(b_p1+b_p4-b_p3-b_p6)
P(4)/P(5)| exp(b_p2+b_p5-b_p3-b_p6);

%NLEstimate(instore=NLE, fdata=fd, df=?)

 

Thank you!

 

Suze

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1407 views
  • 0 likes
  • 2 in conversation