Programming the statistical procedures from SAS

Count Data

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Count Data

[ Edited ]

I am going to use Negative Binomial Regression to run some data.My dependent variable is count variable and independent variables are also count variable. Two moderators are continuous variables. 

 

I searched the following code. My question are:

 

1) if my independent variables are not categorical variable (device is a categorical variable in that example), what command do I need to use? Still use "class" (underlined) before the independent variables?

 

2) I will have two moderators, how can I add them in the code? Thanks in advance!

 

proc genmod data=have;
class device;
model count=device/ offset=logt dist=NB
link=log;
run;

 


Accepted Solutions
Solution
‎04-10-2018 12:03 PM
SAS Employee
Posts: 386

Re: Count Data

Posted in reply to dapenDaniel

If you don't want to treat your Device predictor as categorical (represented by a set of design variables, resulting in an effect with multiple degrees of freedom), then you can drop the CLASS statement. If it is only in the MODEL statement, then it will by treated as continuous (with 1 degree of freedom). You would probably want your moderator variables added to the MODEL statement as both main effects and interactions with your Device predictor:

 

model count = device a b device*a device*b

View solution in original post


All Replies
Solution
‎04-10-2018 12:03 PM
SAS Employee
Posts: 386

Re: Count Data

Posted in reply to dapenDaniel

If you don't want to treat your Device predictor as categorical (represented by a set of design variables, resulting in an effect with multiple degrees of freedom), then you can drop the CLASS statement. If it is only in the MODEL statement, then it will by treated as continuous (with 1 degree of freedom). You would probably want your moderator variables added to the MODEL statement as both main effects and interactions with your Device predictor:

 

model count = device a b device*a device*b

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 122 views
  • 0 likes
  • 2 in conversation