BookmarkSubscribeRSS Feed
Takdir
Obsidian | Level 7

I need to do autocorrelation for multiple firm year observation for the whole data. I know how to do it for a data with single firm with multiple observation but not multiple firm-year. here is an example (profit is the dependent variable, cash and size is the independent variable).

input firm $ year profit cash size;

data work.ac;

 

 datalines;

A 2001 76 45 443345
A 2002 76 65 456
A 2003 85 45 678
A 2004 95 76 345
A 2005 45 76 567
B 2001 34 87 567
B 2002 87 34 345
B 2003 56 65 353
B 2004 43 23 356
B 2005 45 54 546
C 2001 87 23 123
C 2002 35 54 234
C 2003 34 23 546
C 2004 87 54 234
C 2005 45 23 123
D 2001 76 54 456
D 2002 45 23 678
D 2003 76 12 345
D 2004 56 54 234
D 2005 34 23 123

6 REPLIES 6
Reeza
Super User
So you need to account for multiple companies at once or need it done for each firm individually?
Takdir
Obsidian | Level 7

multiple company at once. there thousands of firm in actual data.

Reeza
Super User
I don’t know what the math behind that is... do you have any reference? Never seen that done before.
PGStats
Opal | Level 21

proc autoreg (in SAS/ETS) would be the perfect tool for this. Something like:

 

proc autoreg data=ac;

class firm;

model profit = firm / nlag=1;

run;

PG
Takdir
Obsidian | Level 7

profit is the dependent variable, cash and size is the independent variable.

will it make any changes in the code?

PGStats
Opal | Level 21

You can specify any linear model, as you would in proc glm.

 

Look at the documentation.

PG