Hello Forum-members,
Problem:
based on a panel data set i want to make a regression where i regress working capital (delta_wc) (dependent variable) on cashflow t-1 (cfom1), cashflow t=0 (cfo0), cashflow t+1 (cfop1) and revenues (delta_rev) [independent variables].
My data set looks like this:
However, i do not want to just regress (reg) delta_wc on the dependent variables mentioned above, but rather i want to make this regression for each deal no (three observation per one deal number) (foreach). --> in the context of this example, i would like to have two regressions equations, one for 2600017020 and one for2600718020.
After that, i would like to calculate for each deal number and observation (t-2. t-3, t-4) the delta_wc value estimated from the regression equation (egen) (Reason: I want to be able to calculate the residuals).
Now, i have the following question:
Is there a way which allows me to combine the reg command with foreach & egen?
Thank you very much in advance and kind regards!
Problem:
based on a panel data set i want to make a regression where i regress working capital (delta_wc) (dependent variable) on cashflow t-1 (cfom1), cashflow t=0 (cfo0), cashflow t+1 (cfop1) and revenues (delta_rev) [independent variables].
My data set looks like this:
|
After that, i would like to calculate for each deal number and observation (t-2. t-3, t-4) the delta_wc value estimated from the regression equation (egen) (Reason: I want to be able to calculate the residuals).
Now, i have the following question:
Is there a way which allows me to combine the reg command with foreach & egen?
Thank you very much in advance and kind regards!


Comment