Bastian,
irrespective of whether or not these regressions are a sensible thing to do:
-help capture- has been recommended, and you can use -capture- with
-noisily- inside your loop.
In cases where missing values don't allow a regression, Stata will
simply carry on.
forvalues i=1977/2007 {
capture noisily reg dependent_var indep_var1 indep_var2 if
Observation_Year <= `i', robust cluster (firms)
}
-noisily- leads to the output being displayed; you can omit it if you
just grab the results in matrices. Without -noisily-, -capture- will
eat output and error messages.
HTH,
Eva
2008/10/5 <[email protected]>:
> Dear Stata users ,
>
> I am using this command to run a OLS regression:
>
> forvalues i=1977/2007 {
> reg dependent_var indep_var1 indep_var2 if Observation_Year <= `i', robust cluster (firms)
> }
>
> However, STATA displays in this case "no observations" and it is not possible to run the regression.
>
> For instance, in 1980, I have observations of the second independent variable and the dependent variable only, but I thought that STATA would ignore this year and continue the regression in 1981 instead. Obviously, it is not the case!
>
> So what should I do about this problem ? Any ideas???
>
> Thank you very much !
>
> Bastian S
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/