perform a regression for each crossid individually in a panel workfile
Posted: Thu Feb 22, 2018 1:12 pm
Dear users,
I have a panel workfile with a sample of 31 cross-sections and 500 time periods. I would like to run a single regression for each crossid individually.
my cross section variable is "ID" which has values between 1 and 31. I uploaded the data correctly, having variables stacked over each ID from t=1 to T.
I would like to get a equation estimate for each cross id separately (which contain the t oberservations) Y = C + X1 + X2 + X3. and i would store the regressions as linreg1, linreg2,..., linreg31
I tried:
for !i=1 to 31
if @crossid=!i
equation linreg{!i}.LS Y X1 X2 X3
endif
next
But I get the error term:
Syntax error in control statement in "IF @CROSSID=1".
Can any one help me? many thanks in advande!
Best
I have a panel workfile with a sample of 31 cross-sections and 500 time periods. I would like to run a single regression for each crossid individually.
my cross section variable is "ID" which has values between 1 and 31. I uploaded the data correctly, having variables stacked over each ID from t=1 to T.
I would like to get a equation estimate for each cross id separately (which contain the t oberservations) Y = C + X1 + X2 + X3. and i would store the regressions as linreg1, linreg2,..., linreg31
I tried:
for !i=1 to 31
if @crossid=!i
equation linreg{!i}.LS Y X1 X2 X3
endif
next
But I get the error term:
Syntax error in control statement in "IF @CROSSID=1".
Can any one help me? many thanks in advande!
Best