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
multiple company at once. there thousands of firm in actual data.
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;
profit is the dependent variable, cash and size is the independent variable.
will it make any changes in the code?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.