-------------------------------------------------------------------------------
       log:  /Volumes/ecxs2/users/baum/compustatcompann/UDCL7B07-1-9210.smcl
  log type:  smcl
 opened on:  17 Feb 2009, 15:31:30


. * read crsp-compustat merged file, set up for merge with UDCL_IRRC_matched . insheet using 071201862.txt,clear (11 vars, 1609123 obs)

. saveold crspcompustat,replace file crspcompustat.dta saved

. todate date, gen(ymd) p(yyyymmdd)

. g yeara = year(ymd)

. g ym = mofd(ymd)

. * collapse to year using sd(monthly data) . * screen high, low prices . replace prch = . if prch==0 | prch > 1000 (9857 real changes made, 9857 to missing)

. replace prcl = . if prcl==0 | prcl > 1000 (8273 real changes made, 8273 to missing)

. g prc = 0.5*(prch+prcl) (53545 missing values generated)

. bysort cnum yeara: egen prsd = sd(prc) (45058 missing values generated)

. su

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- gvkey | 1609123 34925.4 41290.64 1004 270705 npermno | 1592146 65265.4 25503.31 10001 93316 linkdt | 1609123 1.99e+07 114737.7 1.93e+07 2.01e+07 linkenddt | 0 cnum | 0 -------------+-------------------------------------------------------- smbl | 0 date | 1609123 2.00e+07 47069.11 1.99e+07 2.01e+07 prch | 1555582 19.74071 45.81439 .0001 1000 prcl | 1557165 16.76635 42.23882 .0001 1000 cshtrm | 1552985 7730.078 50924.8 0 5335884 -------------+-------------------------------------------------------- cshoq | 1476053 76.08286 351.0168 0 10880 ymd | 1609123 14121.43 1721.746 10988 17166 yeara | 1609123 1998.124 4.707026 1990 2006 ym | 1609123 462.9919 56.56553 360 563 prc | 1555578 17.86921 39.74432 .0001 1000 -------------+-------------------------------------------------------- prsd | 1564065 3.342382 11.65965 0 326.6232

. by cnum yeara: keep if _n==12 & prsd>0 (1486068 observations deleted)

. su

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- gvkey | 123055 32651.25 39145.11 1004 270287 npermno | 121711 64271.69 25743.43 10001 93316 linkdt | 123055 1.99e+07 115505.5 1.93e+07 2.01e+07 linkenddt | 0 cnum | 0 -------------+-------------------------------------------------------- smbl | 0 date | 123055 2.00e+07 47105.27 1.99e+07 2.01e+07 prch | 119131 19.33344 44.28565 .0001 1000 prcl | 119231 16.37202 40.5082 .0001 1000 cshtrm | 118969 8110.551 53902.13 0 3628998 -------------+-------------------------------------------------------- cshoq | 113867 79.18291 361.1199 0 10880 ymd | 123055 14122.22 1723.941 10988 17166 yeara | 123055 1998.126 4.710315 1990 2006 ym | 123055 463.0178 56.63769 360 563 prc | 119131 17.53033 38.66808 .0001 1000 -------------+-------------------------------------------------------- prsd | 119816 3.194133 11.36649 .0000144 326.6232

. keep cnum yeara prsd

. saveold pricevol, replace file pricevol.dta saved

. . use UDCL_IRRC_matched_9210, clear

. sort cnum yeara

. merge cnum yeara using pricevol variables cnum yeara do not uniquely identify observations in the master data

. tab yeara

fiscal year | Freq. Percent Cum. ------------+----------------------------------- 1990 | 6,112 4.90 4.90 1991 | 6,104 4.89 9.79 1992 | 6,355 5.09 14.88 1993 | 6,803 5.45 20.33 1994 | 7,405 5.93 26.26 1995 | 7,663 6.14 32.40 1996 | 7,878 6.31 38.71 1997 | 8,201 6.57 45.28 1998 | 8,017 6.42 51.70 1999 | 7,977 6.39 58.09 2000 | 7,886 6.32 64.41 2001 | 7,761 6.22 70.63 2002 | 7,501 6.01 76.64 2003 | 7,220 5.78 82.42 2004 | 6,839 5.48 87.90 2005 | 6,848 5.49 93.39 2006 | 6,707 5.37 98.76 2007 | 1,548 1.24 100.00 ------------+----------------------------------- Total | 124,825 100.00

. tab _merge

_merge | Freq. Percent Cum. ------------+----------------------------------- 1 | 1,770 1.42 1.42 2 | 97,991 78.50 79.92 3 | 25,064 20.08 100.00 ------------+----------------------------------- Total | 124,825 100.00

. // drop if _merge<3 . // do not remove _merge==1 records for 2007 . drop if _merge == 2 (97991 observations deleted)

. drop _merge

. tab yeara

fiscal year | Freq. Percent Cum. ------------+----------------------------------- 1990 | 1,295 4.83 4.83 1991 | 1,262 4.70 9.53 1992 | 1,241 4.62 14.15 1993 | 1,346 5.02 19.17 1994 | 1,312 4.89 24.06 1995 | 1,365 5.09 29.15 1996 | 1,320 4.92 34.06 1997 | 1,236 4.61 38.67 1998 | 1,677 6.25 44.92 1999 | 1,527 5.69 50.61 2000 | 1,548 5.77 56.38 2001 | 1,457 5.43 61.81 2002 | 1,771 6.60 68.41 2003 | 1,719 6.41 74.82 2004 | 1,847 6.88 81.70 2005 | 1,749 6.52 88.22 2006 | 1,614 6.01 94.23 2007 | 1,548 5.77 100.00 ------------+----------------------------------- Total | 26,834 100.00

. duplicates list cnum yeara

Duplicates in terms of cnum yeara

+---------------------------------+ | group: obs: cnum yeara | |---------------------------------| | 1 1161 023608 2007 | | 1 1162 023608 2007 | | 2 1206 025537 2007 | | 2 1207 025537 2007 | | 3 3569 092113 2007 | |---------------------------------| | 3 3570 092113 2007 | | 4 19597 748356 2007 | | 4 19598 748356 2007 | +---------------------------------+

. duplicates drop cnum yeara, force

Duplicates in terms of cnum yeara

(4 observations deleted)

. saveold UDCL_IRRC_vol_9210,replace file UDCL_IRRC_vol_9210.dta saved

. log close log: /Volumes/ecxs2/users/baum/compustatcompann/UDCL7B07-1-9210.smcl log type: smcl closed on: 17 Feb 2009, 15:32:50 -------------------------------------------------------------------------------