-------------------------------------------------------------------------------------------------------------------- name: log: /disk/nber10/SCCS/morg/sources/match2002.log log type: text opened on: 5 Feb 2013, 12:31:02 . *by Jean Roth, 2003-01-30, jroth@nber.org . *This program takes a minute or two to run per year . set more 1 . . local latest_year=2003 . . ! rm -f /tmp/match.raw match.dct matchhead . ! echo >matchhead dictionary using /tmp/match.raw . program define match2 1. if `1' < 1994 { 2. !zcat /home/data/morg/raw/morg`2'.Z |tr "\-A" " " >/tmp/match.raw 3. } 4. if `1' >= 1994 & `1' <= 2010 { 5. !zcat /home/data/morg/raw/morg`2'.Z >/tmp/match.raw 6. } 7. if `1' >= 2011 { 8. !bzcat /home/data/morg/raw/morg`2'.bz2 >/tmp/match.raw 9. } 10. *if `1' >= 1994 {!zcat /homes/nber/jroth/morg/morg`2'.Z >/tmp/match.raw} . ! cat /home/data/morg/sources/matchhead /home/data/morg/sources/match`3'.dbd >./match.dct 11. quietly infile using match if mage>15&mage!=. 12. #delimit cr delimiter now cr . . * Miscellaneous (record keeping) variables . gen id = _n 13. if `1' == 1994 { 14. replace hhid = hhid94 15. drop hhid94 16. } 17. if `1'== 1995 { 18. replace hhid = hhid94 if intmonth<9 19. drop hhid94 20. } 21. if `1' > 1995 & `1' <= 1997 { 22. drop hhid94 23. } 24. . * Person Match . unab vlist: _all 25. sort `vlist' 26. generate int mym = `1' * 10 + mminsamp 27. label var mym "Match year and month-in-sample" 28. display "Sort vars" 29. local sort_stem mym intmonth state hhid hhnum 30. local sortnf `sort' lineno 31. local sortf `sort' famnum lineno 32. local sort94 `sort' famnum lineno serial 33. if ( `1' < 1984 ) { 34. local sort `sort_stem' `sortnf' 35. } 36. if ( `1' >= 1984 & `1' < 1994 ) { 37. local sort `sort_stem' `sortf' 38. } 39. if (`1' >= 1994 ) { 40. local sort `sort_stem' `sort94' 41. } 42. display "sort `sort' id" 43. sort `sort' id 44. by `sort' : gen dup = _n 45. . display "Removing duplicates to avoid creating extra observations" 46. ** WARNING: If merge variable duplicates aren't eliminated from . ** the master database too, then extra observations will be created" . ** re: http://www.stata.com/support/faqs/data/merge.html . tab dup 47. drop if dup>1 48. drop dup 49. saveold /home/data/morg/match/match`1'4.dta, replace 50. drop if mminsamp==4 51. drop mminsamp 52. if ( `1' == 1984 ) { 53. sort `sort_stem' `sortnf' 54. } 55. if ( `1' == 1994 ) { 56. sort `sort_stem' `sortf' 57. } 58. saveold /home/data/morg/match/match`1'8.dta,replace 59. clear 60. use /home/data/morg/match/match`1'4.dta 61. drop if mminsamp==8 62. drop mminsamp 63. saveold /home/data/morg/match/match`1'4.dta,replace 64. clear 65. ! rm -f match.dct /tmp/match.raw 66. end . * Each block of commands does one year of the data. The data must be . * decompressed, and possibly have dashes converted to blanks. . * Then a dictionary for the particular year is prepared by . * concatenating a one line header (with the file name) to a generic . * dictionary body that covers several years of data that used the . * same format. . *Lastly, the data is read, modified, summarized and saved. . . *match2 1979 79 79_83 . *match2 1980 80 79_83 794 818 . *match2 1981 81 79_83 804 828 . *match2 1982 82 79_83 814 838 . *match2 1983 83 79_83 824 848 . *match2 1984 84 84_88 834 858 . *match2 1985 85 84_88 844 868 . *match2 1986 86 84_88 854 878 . *match2 1987 87 84_88 864 888 . *match2 1988 88 84_88 874 898 . *match2 1989 89 89_93 884 908 . *match2 1990 90 89_93 894 918 . *match2 1991 91 89_93 904 928 . *match2 1992 92 89_93 914 938 . *match2 1993 93 89_93 924 948 . *match2 1994 94 94_97 934 958 . *match2 1995 95 94_97 944 968 . *match2 1996 96 94_97 954 978 . *match2 1997 97 94_97 964 988 . *match2 1998 98 98 974 998 . *match2 1999 99 98 984 008 . *match2 2000 00 98 994 018 . *match2 2001 01 98 004 028 . *match2 2002 02 98 014 038 . *match2 2003 03 03 024 048 . *match2 2004 04 03 034 058 . *match2 2005 05 03 044 068 . *match2 2006 06 03 054 078 . *match2 2007 07 03 064 088 . *match2 2008 08 03 074 098 . *match2 2009 09 03 084 108 . *match2 2010 10 03 094 118 . match2 2011 11 03 104 128 (10935 missing values generated) Sort vars sort mym intmonth state hhid hhnum famnum lineno serial id Removing duplicates to avoid creating extra observations dup | Freq. Percent Cum. ------------+----------------------------------- 1 | 27,293 66.47 66.47 2 | 2,514 6.12 72.60 3 | 1,382 3.37 75.96 4 | 893 2.17 78.14 5 | 656 1.60 79.74 6 | 512 1.25 80.98 7 | 407 0.99 81.97 8 | 355 0.86 82.84 9 | 300 0.73 83.57 10 | 264 0.64 84.21 11 | 242 0.59 84.80 12 | 220 0.54 85.34 13 | 197 0.48 85.82 14 | 185 0.45 86.27 15 | 171 0.42 86.68 16 | 163 0.40 87.08 17 | 154 0.38 87.46 18 | 146 0.36 87.81 19 | 133 0.32 88.14 20 | 123 0.30 88.44 21 | 119 0.29 88.73 22 | 112 0.27 89.00 23 | 105 0.26 89.25 24 | 102 0.25 89.50 25 | 99 0.24 89.74 26 | 96 0.23 89.98 27 | 92 0.22 90.20 28 | 88 0.21 90.42 29 | 85 0.21 90.62 30 | 80 0.19 90.82 31 | 77 0.19 91.01 32 | 75 0.18 91.19 33 | 72 0.18 91.36 34 | 67 0.16 91.53 35 | 66 0.16 91.69 36 | 64 0.16 91.84 37 | 61 0.15 91.99 38 | 59 0.14 92.14 39 | 57 0.14 92.27 40 | 57 0.14 92.41 41 | 55 0.13 92.55 42 | 54 0.13 92.68 43 | 54 0.13 92.81 44 | 54 0.13 92.94 45 | 52 0.13 93.07 46 | 51 0.12 93.19 47 | 49 0.12 93.31 48 | 48 0.12 93.43 49 | 47 0.11 93.54 50 | 47 0.11 93.66 51 | 45 0.11 93.77 52 | 45 0.11 93.88 53 | 41 0.10 93.98 54 | 41 0.10 94.08 55 | 41 0.10 94.18 56 | 41 0.10 94.28 57 | 41 0.10 94.38 58 | 40 0.10 94.47 59 | 39 0.09 94.57 60 | 39 0.09 94.66 61 | 39 0.09 94.76 62 | 39 0.09 94.85 63 | 38 0.09 94.95 64 | 37 0.09 95.04 65 | 37 0.09 95.13 66 | 36 0.09 95.21 67 | 36 0.09 95.30 68 | 35 0.09 95.39 69 | 35 0.09 95.47 70 | 35 0.09 95.56 71 | 35 0.09 95.64 72 | 35 0.09 95.73 73 | 34 0.08 95.81 74 | 34 0.08 95.89 75 | 33 0.08 95.97 76 | 32 0.08 96.05 77 | 32 0.08 96.13 78 | 31 0.08 96.21 79 | 31 0.08 96.28 80 | 28 0.07 96.35 81 | 28 0.07 96.42 82 | 28 0.07 96.49 83 | 27 0.07 96.55 84 | 26 0.06 96.61 85 | 26 0.06 96.68 86 | 25 0.06 96.74 87 | 24 0.06 96.80 88 | 24 0.06 96.86 89 | 24 0.06 96.91 90 | 24 0.06 96.97 91 | 24 0.06 97.03 92 | 24 0.06 97.09 93 | 22 0.05 97.14 94 | 22 0.05 97.20 95 | 21 0.05 97.25 96 | 21 0.05 97.30 97 | 21 0.05 97.35 98 | 21 0.05 97.40 99 | 20 0.05 97.45 100 | 20 0.05 97.50 101 | 18 0.04 97.54 102 | 18 0.04 97.59 103 | 18 0.04 97.63 104 | 16 0.04 97.67 105 | 16 0.04 97.71 106 | 15 0.04 97.74 107 | 15 0.04 97.78 108 | 15 0.04 97.82 109 | 15 0.04 97.85 110 | 15 0.04 97.89 111 | 15 0.04 97.93 112 | 14 0.03 97.96 113 | 14 0.03 98.00 114 | 14 0.03 98.03 115 | 14 0.03 98.06 116 | 14 0.03 98.10 117 | 14 0.03 98.13 118 | 13 0.03 98.16 119 | 13 0.03 98.20 120 | 13 0.03 98.23 121 | 13 0.03 98.26 122 | 13 0.03 98.29 123 | 13 0.03 98.32 124 | 13 0.03 98.35 125 | 13 0.03 98.39 126 | 13 0.03 98.42 127 | 13 0.03 98.45 128 | 13 0.03 98.48 129 | 13 0.03 98.51 130 | 13 0.03 98.54 131 | 13 0.03 98.58 132 | 12 0.03 98.60 133 | 11 0.03 98.63 134 | 11 0.03 98.66 135 | 11 0.03 98.68 136 | 11 0.03 98.71 137 | 11 0.03 98.74 138 | 10 0.02 98.76 139 | 10 0.02 98.79 140 | 10 0.02 98.81 141 | 10 0.02 98.84 142 | 9 0.02 98.86 143 | 9 0.02 98.88 144 | 9 0.02 98.90 145 | 9 0.02 98.92 146 | 9 0.02 98.95 147 | 9 0.02 98.97 148 | 8 0.02 98.99 149 | 8 0.02 99.01 150 | 8 0.02 99.03 151 | 8 0.02 99.05 152 | 8 0.02 99.06 153 | 8 0.02 99.08 154 | 8 0.02 99.10 155 | 7 0.02 99.12 156 | 7 0.02 99.14 157 | 7 0.02 99.15 158 | 7 0.02 99.17 159 | 7 0.02 99.19 160 | 7 0.02 99.21 161 | 7 0.02 99.22 162 | 7 0.02 99.24 163 | 7 0.02 99.26 164 | 7 0.02 99.27 165 | 7 0.02 99.29 166 | 7 0.02 99.31 167 | 7 0.02 99.33 168 | 7 0.02 99.34 169 | 7 0.02 99.36 170 | 6 0.01 99.37 171 | 6 0.01 99.39 172 | 6 0.01 99.40 173 | 6 0.01 99.42 174 | 6 0.01 99.43 175 | 6 0.01 99.45 176 | 5 0.01 99.46 177 | 5 0.01 99.47 178 | 5 0.01 99.48 179 | 5 0.01 99.50 180 | 4 0.01 99.51 181 | 4 0.01 99.52 182 | 4 0.01 99.53 183 | 4 0.01 99.53 184 | 4 0.01 99.54 185 | 4 0.01 99.55 186 | 4 0.01 99.56 187 | 4 0.01 99.57 188 | 4 0.01 99.58 189 | 4 0.01 99.59 190 | 4 0.01 99.60 191 | 4 0.01 99.61 192 | 4 0.01 99.62 193 | 4 0.01 99.63 194 | 4 0.01 99.64 195 | 4 0.01 99.65 196 | 4 0.01 99.66 197 | 4 0.01 99.67 198 | 4 0.01 99.68 199 | 4 0.01 99.69 200 | 4 0.01 99.70 201 | 4 0.01 99.71 202 | 4 0.01 99.72 203 | 4 0.01 99.73 204 | 4 0.01 99.74 205 | 4 0.01 99.75 206 | 4 0.01 99.76 207 | 4 0.01 99.77 208 | 3 0.01 99.78 209 | 3 0.01 99.78 210 | 3 0.01 99.79 211 | 3 0.01 99.80 212 | 3 0.01 99.81 213 | 3 0.01 99.81 214 | 3 0.01 99.82 215 | 3 0.01 99.83 216 | 3 0.01 99.83 217 | 3 0.01 99.84 218 | 3 0.01 99.85 219 | 3 0.01 99.86 220 | 3 0.01 99.86 221 | 2 0.00 99.87 222 | 2 0.00 99.87 223 | 2 0.00 99.88 224 | 2 0.00 99.88 225 | 2 0.00 99.89 226 | 2 0.00 99.89 227 | 2 0.00 99.90 228 | 2 0.00 99.90 229 | 2 0.00 99.91 230 | 2 0.00 99.91 231 | 2 0.00 99.92 232 | 2 0.00 99.92 233 | 2 0.00 99.93 234 | 2 0.00 99.93 235 | 1 0.00 99.93 236 | 1 0.00 99.94 237 | 1 0.00 99.94 238 | 1 0.00 99.94 239 | 1 0.00 99.94 240 | 1 0.00 99.95 241 | 1 0.00 99.95 242 | 1 0.00 99.95 243 | 1 0.00 99.95 244 | 1 0.00 99.96 245 | 1 0.00 99.96 246 | 1 0.00 99.96 247 | 1 0.00 99.96 248 | 1 0.00 99.97 249 | 1 0.00 99.97 250 | 1 0.00 99.97 251 | 1 0.00 99.97 252 | 1 0.00 99.98 253 | 1 0.00 99.98 254 | 1 0.00 99.98 255 | 1 0.00 99.98 256 | 1 0.00 99.99 257 | 1 0.00 99.99 258 | 1 0.00 99.99 259 | 1 0.00 99.99 260 | 1 0.00 100.00 261 | 1 0.00 100.00 262 | 1 0.00 100.00 ------------+----------------------------------- Total | 41,058 100.00 (13765 observations deleted) (note: file /home/data/morg/match/match20114.dta not found) file /home/data/morg/match/match20114.dta saved (525 observations deleted) (note: file /home/data/morg/match/match20118.dta not found) file /home/data/morg/match/match20118.dta saved (471 observations deleted) file /home/data/morg/match/match20114.dta saved . end of do-file . exit,clear