Help using Base SAS procedures

Count regression code

Frequent Contributor
Posts: 96

Count regression code

Hi All,

I want to run a regression where the dependent variable, Numcomment, is a count of number of comments a firm would receive. In the regression, I also need to control for industry fixed effects. Can someone provide me with the SAS code for count regression that controls for industry fixed effects?

Thank you,


Respected Advisor
Posts: 4,736

Re: Count regression code

How do you expect anyone posting actual code without you providing sample data (a data step creating such data) and a description of how the result should look like.

Also: What are your thoughts about how this could be done? Have you already developed some code? If yes: Post it as well.

Frequent Contributor
Posts: 96

Re: Count regression code

Sorry for the incomplete information. The subset of data looks as follows:

Gvkey     Year     Numcomment     X1     X2     industry

001          2001     5                     0.5     1     13

001          2002     9                     0.8     1     13

002          2001     2                     0.5     0     56

002          2002     4                     0.8     1     56

003          2001     7                     0.5     1     46

003          2002     5                     0.8     0     46

004          2001     4                     0.5     0     13

004          2002     4                     0.8     0     13

Gvkey is the firm identtifier, Numcomment is the dependent variable and is the number of comments (count variable), X1 and X2 are some independent variables, and industry is the control for industry.

The two codes I got from my searches is as follows:

proc genmod data = have ;

class gvkey industry;

model numcomment =x1 x2 industry/link=log dist=poisson;

run; quit;

proc countreg data=have;

       model numcomment =x1 x2 industry / dist=poisson printall;


Can someone please tell me which of the above codes will be more appropriate when the dependent variable is a count? Also I need to control for industry fixed effect.

Thank you.

Posts: 62

Re: Count regression code


I think there is no difference in the estimations parts of two PROC. but some additional features are different.

There are some major topics you should consider to check the appropriateness of your fitted model. One of them is zero inflated:

There are also AIC,BIC and overdispersion problems:

I think you should take consideration on your modeling strategy instead of choosing the more appropriate SAS procedure.

In the following paper, you can find approximately all you need for answering your question:

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation