capt log close
set more off
log using udcl9218-1, replace
// udcl9218-1  examine Gindex for UDCL estimation sample, Compustat through 2007, IRRC through 2006
use udcl9218_estsample, clear
desc
su
egen fcount = tag(firmid)
count if fcount
bys firmid: gen nobs = _N
su nobs
tab nobs
bys firmid: g dgindex = (D.gindex != 0 & _n > 1)
bys firmid: g sdgindex = sum(dgindex)
bys firmid: g fdgindex = sdgindex[_N] if _n == _N & _N > 1
su dgindex sdgindex fdgindex
l firmid gindex dgindex sdgindex fdgindex in 1/50, sepby(firmid)
tab fdgindex
// of the 1630 firms that have more than 1 observation in the estimation sample, 
// 519 (31.8%) have not changed their Gindex. 557 (34%) have changed it once,
// 341 (21%) changed it twice, etc.

log close
set more on
log2html udcl9218-1, replace