There is no built in feature of a command that restricts regressions to at least 10 observations, but what you can do is modify the code so that it discards results based on fewer than 10 observations.
Code:
gen Jones_Modified = . forval y = 1999(1) 2016 { forval i = 1(1) 52 { display `i' display `y' capture reg TA B1 B2 B3 if `i' == industry & `y' == year, noconstant if c(rc) == 0 { // SUCCESSFUL REGRESSION if e(N) >= 10 { // IGNORE IF < 10 OBS IN REGRESSION predict r if `i' == industry & `y' == year, resid replace Jones_Modified = r if `i' == industry & `y' == year drop r } } else if !inlist(c(rc), 2000, 2001) { // UNANTICIPATED ERROR display as error "Unexpected error encountered" exit c(rc) } else { // NO OR INSUFFICIENT OBSERVATIONS; NOTIFY & PROCEED display "No or insufficient observations" } } }
Comment