Hi all,
Apologies if this is very simple or has been asked before. I have searched through many topics and have struggled to find an answer. Any help is greatly appreciated.
I am trying to run a regression command for each observation in a dataset, increasing by one observation each time. It may be more useful if I post the code I have that works so far:
This works (although I am sure there must be a more efficient way of doing this) but I believe it is creating errors down the line when I try to add the following:
When attempting this code, it returns the error of:
I interpret this as: it's trying to store my estimate, but having / in the estimate name is causing the error?
Although, I know I could be completely wrong here. I am very much a Stata beginner and I am making a lot of errors along the way!
Any help is greatly appreciated!
Thanks
Apologies if this is very simple or has been asked before. I have searched through many topics and have struggled to find an answer. Any help is greatly appreciated.
I am trying to run a regression command for each observation in a dataset, increasing by one observation each time. It may be more useful if I post the code I have that works so far:
Code:
foreach x in 1/11 1/12 1/13 1/14 1/15 1/16 1/17 1/18 1/19 1/20 1/21 1/22 1/23 1/24 1/25 1/26 1/27 1/28 1/29 1/30 1/31 1/32 1/33 1/34 1/35 { reg DV IV1 IV2 IV3 in `x' }
Code:
foreach x in 1/11 1/12 1/13 1/14 1/15 1/16 1/17 1/18 1/19 1/20 1/21 1/22 1/23 1/24 1/25 1/26 1/27 1/28 1/29 1/30 1/31 1/32 1/33 1/34 1/35 { reg DV IV1 IV2 IV3 in `x' est store model_`x' }
Code:
/ invalid name 11 invalid name
Although, I know I could be completely wrong here. I am very much a Stata beginner and I am making a lot of errors along the way!
Any help is greatly appreciated!
Thanks
Comment