Hi All,
I am running the a firm fixed effect regression to find the residual, but the error message says my CLASS variable has only one level.
My regression has only one independent variable which I call it 'independent_variable_TACC', and the dependent variable is 'dependent variable_BTD'. I used PROC REG to get residuals before by adding a '/r' after MODEL command, but it seems like PROC GLM does not work in that way. I attached my codes herewith. I am not sure if I need to add both firm_code (gvkey) and year (fyear) in CLASS or only firm_code is needed.
Can anyone tell me how do I get the residual from a firm fixed effect regression? I really appreciate for any help with this problem. Thanks a lot in advance.
proc glm data=rep.DD_BTD_regression;
class gvkey fyear; /*firm fixed effect*/
model dependent_variable_BTD=independent_variable_TACC;
by gvkey fyear;
output out=rep.DD_BTD_residuals /*new data set with residual*/
r=DD_BTD_resid; /*the residual I need*/
run;
Best regards,
Jiaxin
You have class variables that are not in the model. Delete the CLASS statement, try it again.
OR
Add the class variables into the model, and get rid of the BY statement, try it again.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.