Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: perform regression on minimum number of observations stata

 From "Impavido, Gregorio" To "statalist@hsphsun2.harvard.edu" Subject st: RE: perform regression on minimum number of observations stata Date Mon, 29 Jul 2013 14:57:26 +0000

```You could modify your loop as follows:

bysort year industry: gen nobs = _N
forval y=1989/2012 {
forval  i= 1/57 {
di "year = `y' and industry = `i'"
reg DV IV_1 IN_2 IN_3 if  Industry== `i' & year==`y' & nobs>15
}

However, I thought that the "magic number" for the central limit theorem to apply was 30.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nahla Betelmal
Sent: Monday, July 29, 2013 10:32 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: perform regression on minimum number of observations stata

Hi Statalist,

my data consists of several years and several industries (each industry contain several firms). I run  cross-sectional regressions as follow :

forval y=1989/2012 {
forval  i= 1/57 {
reg DV IV_1 IN_2 IN_3 if  Industry== `i' & year==`y'
}

I have two questions please:

1- According to literature, any industry-year regression with less than 15 observations (i.e. 15 firms) should be disregarded. the tricky thing is that almost every industry-year group has more than 15 firms but some are with missing values to perform the regression. Therefore, the regression could be done with less than 15 observation. How can I account for this in the above loop, so regression with less than 15 complete observations produce missing values instead of actual values!

2- the output does not provide information about the matched year and industry. Is there a way to do it?  I only need that for reporting purpose.

Thank you

Nahla Betelmal
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```