-------------------------------------------------------------------------------------------------------------------------------------------------- name: log: /disk/nber10/SCCS/morg/sources/annual2010.log log type: text opened on: 25 Jan 2012, 14:25:54 . set memory 2000m (2048000k) . set more 1 . *primary family and child variables added 2000-04-20 by Jean Roth, jroth@nber.org . *Y2K compliance by Jean Roth, jroth@nber.org, 2001-01-15 . *Imputed highest grade completed, ihigrdc, added by Jean Roth, jroth@nber.org, 2003-01-20 . *Stata 8 compliance by Jean Roth, jroth@nber.org, 2003-02-28 . *matching variables added by Jean Roth, jroth@nber.org, 2003-02-12 . * run with nohup stata -b do annual2002 & to run in batch mode . do rw . . program rw 1. * grab the annual file . * keep data from the relevant month . * sort by revised weight merge variables . * merge using the revised weight monthly file, 'rwmonyy.dta' . * save the merged file as 'mon' . use /homes/data/morg/annual/rw/annual 2. keep if intmonth==`3' 3. quietly describe 4. display "`3' `2' obs " r(N) 5. local rwlist qstnum intmonth year occurnum 6. sort `rwlist' 7. merge `rwlist' using /homes/data/morg/annual/rw/rw`2'`1' 8. drop if _merge == 2 9. save /homes/data/morg/annual/rw/`2', replace 10. end . end of do-file . ! /bin/rm -f /tmp/aef.raw aef.dct dcthead . capture erase /tmp/aef.raw . capture erase aef.dct . capture erase dcthead . ! echo >dcthead dictionary using /tmp/aef.raw . program define aef2 1. local dct_name "aef`3'.dbd" 2. local raw_name "../raw/morg`2'" 3. display "dct_name `dct_name' raw_name=`raw_name'" 4. if `1' <= 1993 { 5. *!zcat /homes/data/cps-basic/cpsb`2'??.Z |tr "\-A" " " >/tmp/aef.raw . !zcat /homes/data/morg/raw/morg`2'.Z |tr "\-A" " " >/tmp/aef.raw 6. } 7. *if `1' == 1993 { . * *!zcat /homes/data/cps-basic/cpsb`2'??.Z |tr "\-A" " " >/tmp/aef.raw . * !zcat /homes/data/morg/raw/morg`2'.oldweights.Z |tr "\-A" " " >/tmp/aef.raw . *} . if `1' >= 1994 { 8. *!zcat /homes/data/cps-basic/cpsb`2'??.Z >/tmp/aef.raw . !zcat /homes/data/morg/raw/morg`2'.Z >/tmp/aef.raw 9. } 10. *quietly infile using "`dct_name'" if age>15&age!=. , using("`raw_name'") clear . *quietly infile using "`dct_name'" if age>15&age!=. in 1/100 , using("`raw_name'") clear . *! cat /home/data/morg/sources/dcthead /home/data/morg/sources/aef`3'.dbd >./aef.dct . ! cat /home/data/morg/sources/aef`3'.dbd >./aef.dct 11. *quietly infile using aef.dct if age>15&age!=. , using("/tmp/aef.raw") clear . quietly infile using aef.dct , using("/tmp/aef.raw") clear 12. keep if minsamp==4 | minsamp==8 13. gen recnum=_n 14. label variable recnum "Unique record ID number. It's sequence in the original file." 15. quietly describe 16. display "obs " r(N) 17. quietly count if age<=15 18. display "# of persons with age<=15 `r(N)'" 19. quietly count if age==. 20. display "# of non-interview records `r(N)'" 21. tab age , missing 22. tab age if age==. , missing 23. tab age if age<=15 24. keep if age>15 25. keep if age!=. 26. quietly describe 27. display "obs " r(N) " after keeping age>15&age!=. " 28. display "infile successful" 29. #delimit cr delimiter now cr . generate int year = `1' 30. *summarize . tab intmonth if `1'==2005 31. ** Revised Census 2000-based Weights. Impact employment and union variables . if inlist( `1', 2000 , 2001 , 2002 ) { 32. gen id = _n 33. local rwlist qstnum intmonth year occurnum 34. sort `rwlist' 35. quietly describe 36. display "total obs pre-revise `1' " r(N) 37. saveold /homes/data/morg/annual/rw/annual, replace 38. clear 39. rw `2' jan 1 40. rw `2' feb 2 41. rw `2' mar 3 42. rw `2' apr 4 43. rw `2' may 5 44. rw `2' jun 6 45. rw `2' jul 7 46. rw `2' aug 8 47. rw `2' sep 9 48. rw `2' oct 10 49. rw `2' nov 11 50. rw `2' dec 12 51. local monlist feb mar apr may jun jul aug sep oct nov dec 52. clear 53. display "using jan" 54. use /homes/data/morg/annual/rw/jan 55. foreach mon in `monlist' { 56. append using /home/data/morg/annual/rw/`mon' 57. } 58. quietly describe 59. display "total obs post-revise" r(N) 60. display "start renaming" 61. rename neio1icd ind02 62. rename ntio1ocd occ00 63. replace occ00 = . if occ00 < 0 64. rename class94 class94p 65. replace class94p = . if class94p<0 66. . rename neio1cow class94 67. rename earnwt earnwtp 68. rename nworwgt earnwt 69. rename weight weightp 70. rename nwsswgt weight 71. display "done renaming" 72. display "drop 2000" 73. if `1' == 2000 { 74. drop neerncov neernlab 75. } 76. display "rename 2001-2002" 77. if inlist( `1' , 2001 , 2002 ) { 78. rename unioncov unioncop 79. replace unioncop = . if unioncop < 0 80. rename neerncov unioncov 81. rename unionmme unionmep 82. replace unionmep = . if unionmep < 0 83. rename neernlab unionmme 84. } 85. sort id 86. drop id _merge 87. } 88. . * Miscellaneous (record keeping) variables . if `1' == 1994 { 89. replace hhid = hhid94 90. drop hhid94 91. } 92. if `1'== 1995 { 93. replace hhid = hhid94 if intmonth<9 94. drop hhid94 95. } 96. if inlist( `1', 1996 , 1997 ) { 97. drop hhid94 98. } 99. replace hurespli =. if hurespli <0 100. if `1'>=2003 & `1'<=2006 { 101. drop linedad 102. drop linemom 103. } 104. if `1'>=2007 { 105. replace linedad=. if linedad<0 106. replace linemom=. if linemom<0 107. } 108. if ( inlist(`1',2003,2004) | `1'>=2007 ) { 109. drop hurhhscrn 110. drop purkat1 111. drop purkat2 112. } 113. if `1'==2005 { 114. replace hurhhscrn=. if intmonth<=10 | hurhhscrn<0 115. replace purkat1=. if intmonth<=10 | purkat1<0 116. replace purkat2=. if intmonth<=10 | purkat2<0 117. } 118. if `1'==2006 { 119. replace hurhhscrn=. if hurhhscrn<0 120. replace purkat1=. if purkat2<0 121. replace purkat2=. if purkat2<0 122. . } 123. ************************************************** . ** Creating time-series month/year from the first month-in-sample . generate ym_file = ym(year,intmonth) 124. label variable ym_file "time series month from original data" 125. generate ym = ym_file 126. label variable ym "time series month of first month-in-sample" 127. replace ym = ym - 1 if minsamp == 2 128. replace ym = ym - 2 if minsamp == 3 129. replace ym = ym - 3 if minsamp == 4 130. replace ym = ym - 13 if minsamp == 5 131. replace ym = ym - 14 if minsamp == 6 132. replace ym = ym - 15 if minsamp == 7 133. replace ym = ym - 16 if minsamp == 8 134. ************************************************** . * Geography . display "Geography" 135. if `1'==2004 { 136. display "replace serial" 137. replace serial = serial04 if intmonth >= 5 138. replace hrsample = "" if intmonth >= 5 139. replace hhnum = hhnum04 if intmonth >= 5 140. display "replace cmsacode" 141. replace cmsacode = . if intmonth >= 5 142. display "replace msafips" 143. replace msafips = . if intmonth >= 5 144. display "replace smsa93" 145. replace smsa93 = . if smsa93<2 & intmonth<=4 146. replace smsa93 = . if intmonth >= 5 147. display "replacing smsa04 in May 2004 and later" 148. replace smsa04 = . if smsa04<2 & intmonth >= 5 149. } 150. if `1' == 2005 { 151. replace serial = serial04 152. replace hrsample ="" 153. replace smsa04 = . if smsa04<2 & intmonth >= 5 154. } 155. if `1' >= 2005 { 156. replace hhnum = hhnum04 157. display "dropping cmsacode msafips smsa93" 158. drop cmsacode msafips smsa93 159. } 160. if `1' == 2003 { 161. display "dropping non-2003 variables" 162. drop cbsafips smsa04 serial04 hhnum04 hrhhid2 163. } 164. if `1'==2004 { 165. display "replacing pre-May 2004 variables" 166. replace cbsafips = . if intmonth <=4 167. replace smsa04 = . if intmonth <=4 168. replace hrhhid2 ="" if intmonth <=4 169. } 170. if `1' >= 2004 { 171. drop serial04 hhnum04 172. } 173. if `1' >= 1996 & `1' <= 2003 { 174. replace smsa93 = . if smsa93<2 175. } 176. display "smsasize = . if smsasize <=0" 177. capture replace smsasize = . if smsasize <=0 178. if `1' == 1995 { 179. replace smsastat = smsa995 if intmonth>8 180. replace icntcity = icntct94 if intmonth<9 181. replace centcity = centcitx if intmonth<9 182. replace smsa93 = . if intmonth>=9 & smsa93<2 183. replace smsa93 = . if intmonth<9 184. drop pmsarank 185. dis "gen smsa80" 186. generate smsa80 = smsasize 187. dis "rep smsa80" 188. replace smsa80 = . if intmonth >= 10 189. dis "replace county" 190. replace county = . if county < 0 191. dis "drop county" 192. if intmonth<9 { 193. drop county 194. } 195. } 196. display "inlisting 96 97" 197. if inlist( `1', 1996 , 1997 ) { 198. replace smsastat = smsa995 199. } 200. display "replace smsastat = . if smsastat==3 | smsastat<0" 201. replace smsastat = . if smsastat==3 | smsastat<0 202. if `1' == 1994 { 203. drop smsa93 204. replace centcity = centcitx 205. replace icntcity = icntct94 206. replace pmsarank = . if intmonth > 3 207. replace pmsarank = . if pmsarank <= 0 208. replace cmsarank = . if intmonth > 3 209. } 210. if inlist( `1', 1996 , 1997 ) { 211. drop pmsarank 212. } 213. if `1' >= 1994 & `1' <= 1997 { 214. drop centcitx icntct94 smsa995 215. } 216. if `1' >= 1994 { 217. replace peinusyr = . if peinusyr < 0 218. } 219. display "replace centcity = . if centcity==4 | centcity<=0" 220. replace centcity = . if centcity==4 | centcity<=0 221. if `1' >= 1986 & `1' < 1994 { 222. replace pmsarank = . if pmsarank<=0 223. } 224. if `1' >= 1995 & `1' <= 1997 { 225. drop cmsarank 226. } 227. if `1' >= 1986 { 228. replace icntcity = . if icntcity<=0 229. } 230. if `1' > 1984 & `1' < 1995 { 231. replace cmsarank = . if cmsarank<=0 232. } 233. if `1' >= 1989 & `1' <= 2004 { 234. replace msafips = . if msafips <=0 235. replace cmsacode = . if cmsacode<=0 236. } 237. ** 1970 occupation variables are not correct on morg83.raw . if `1' == 1983 { 238. drop docc70 occ70 239. } 240. if `1' == 1985 { 241. replace smsarank = . if intmonth > 9 242. } 243. if `1' == 1984 { 244. display "drop icntcity pmsarank cmsarank" 245. drop icntcity pmsarank cmsarank 246. } 247. if `1' == 1985 & intmonth < 10 { 248. drop icntcity pmsarank cmsarank 249. } 250. if `1' == 1994 { 251. replace cmsarank = . if intmonth>3 252. } 253. display "replace smsasize=. if smsasize<=0" 254. **should line below be commented out??? . capture replace smsasize=. if smsasize<=0 255. if `1' < 1985 { 256. display "generate byte smsa70 = smsasize" 257. generate byte smsa70 = smsasize 258. } 259. if `1' > 1985 & `1' < 1995 { 260. generate byte smsa80 = smsasize 261. } 262. if `1' == 1985 { 263. generate byte smsa70 = smsasize if intmonth<10 264. } 265. if `1' == 1985 { 266. generate byte smsa80 = smsasize if intmonth>9 267. } 268. display "drop smsasize" 269. capture drop smsasize 270. if `1' > 1985 & `1' < 1989 { 271. drop smsarank 272. } 273. if `1' < 1983 { 274. display "drop unioncov unionmme occ80 ind80" 275. drop unioncov unionmme occ80 ind80 276. } 277. . * Demography . display "Demography" 278. if `1' > 1983 & `1' < 1994 { 279. replace ownchild = . if ownchild ==0 280. replace ownchild = ownchild - 1 281. generate int ch613=chldpres 282. generate int ch1417=chldpres 283. } 284. display "if `1' > 1983 & `1' < 1989 {" 285. if `1' > 1983 & `1' < 1989 { 286. generate int ch05= chldpres 287. recode ch05 (4 6/8 = 1) (0/3 5 = 0) 288. recode ch613 (3 5 7/8 = 1) (0/2 4 6 = 0) 289. recode ch1417 (2 5/6 8 =1) (0/1 3/4 7 = 0) 290. } 291. if `1' > 1988 & `1' < 1994 { 292. display "if `1' > 1988 & `1' < 1994 {" 293. generate int ch02 = chldpres 294. generate int ch35 = chldpres 295. recode ch02 (2 6/8 12/14 16 = 1) (0/1 3/5 9/11 15 = 0) 296. recode ch35 (3 6 9/10 12/13 15/16 = 1) (0/2 4/5 7/8 11 14 = 0) 297. recode ch613 (4 7 9 11/12 14/16 = 1) (0/3 5/6 8 10 13 = 0) 298. recode ch1417 (5 8 10/11 13/16 = 1) (0/4 6/7 9 12 = 0 ) 299. generate int ch05 = ch02 300. replace ch05 = ch35 if ch35 == 1 301. label variable ch02 "Children 0-2" 302. label variable ch35 "Children 3-5" 303. } 304. if `1' > 1983 & `1' < 1994 { 305. display "if `1' > 1983 & `1' < 1994 {" 306. label variable ch05 "Children 0-5" 307. label variable ch613 "Children 6-13" 308. label variable ch1417 "Children 6-17" 309. } 310. if `1' >= 1994 & `1' <= 1996 { 311. drop prpertyp 312. } 313. if `1' >= 1997 { 314. replace prpertyp=. if prpertyp<0 315. } 316. if `1' == 1998 { 317. drop ownchild chldpres 318. } 319. if `1' >= 1999 { 320. replace ownchild = . if ownchild < 0 321. replace chldpres = . if chldpres < 0 322. generate int ch02 = chldpres 323. generate int ch35 = chldpres 324. generate int ch613 = chldpres 325. generate int ch1417 = chldpres 326. recode ch02 (1 5/7 11/13 15 = 1) (0 2/4 8/10 14 = 0) 327. recode ch35 (2 5 8/9 11/12 14/15 = 1) (0/1 3/4 6/7 10 13 =0) 328. recode ch613 (3 6 8 10/11 13/15 = 1) (0/2 4/5 7 9 12 = 0) 329. recode ch1417 (4 7 9/10 12/15 = 1) (0/3 5/6 8 11 = 0) 330. generate int ch05 = ch02 331. replace ch05 = ch35 if ch35 == 1 332. } 333. . if `1' == 1999 { 334. replace ownchild = . if intmonth < 10 335. replace chldpres = . if intmonth < 10 336. replace ch613 = . if intmonth < 10 337. replace ch1417 = . if intmonth < 10 338. replace ch05 = . if intmonth < 10 339. replace ch02 = . if intmonth < 10 340. replace ch35 = . if intmonth < 10 341. } 342. if `1' > 1988 & `1' < 1992 { 343. drop grade92 344. } 345. if `1' < 1989 { 346. replace gradeat = gradeat - 1 347. replace marital = 7 if marital==5 348. } 349. if `1' > 1991 { 350. replace grade92 = . if grade92 < 0 351. } 352. if `1' >= 1998 { 353. replace ged = . if ged < 0 354. replace gedhigr = . if gedhigr < 0 355. replace yrcoll = . if yrcoll < 0 356. replace grprof = . if grprof < 0 357. replace gr6cor = . if gr6cor < 0 358. replace ms123 = . if ms123 < 0 359. generate double ihigrdc = . 360. ** Jaeger . label var ihigrdc "Imputed highest grade completed" 361. replace ihigrdc = 0 if grade92==31 362. replace ihigrdc = 2.5 if grade92==32 363. replace ihigrdc = 5.5 if grade92==33 364. replace ihigrdc = 7.5 if grade92==34 365. replace ihigrdc = 9 if grade92==35 366. replace ihigrdc =10 if grade92==36 367. replace ihigrdc =11 if grade92==37 368. replace ihigrdc =12 if grade92==38 369. replace ihigrdc = 0 if grade92==39 & ged==2 & gedhigr==1 370. replace ihigrdc = 2.5 if grade92==39 & ged==2 & gedhigr==2 371. replace ihigrdc = 5.5 if grade92==39 & ged==2 & gedhigr==3 372. replace ihigrdc = 7.5 if grade92==39 & ged==2 & gedhigr==4 373. replace ihigrdc = 9 if grade92==39 & ged==2 & gedhigr==5 374. replace ihigrdc = 10 if grade92==39 & ged==2 & gedhigr==6 375. replace ihigrdc = 11 if grade92==39 & ged==2 & gedhigr==7 376. replace ihigrdc = 12 if grade92==39 & ged==2 & gedhigr==8 377. replace ihigrdc = 12 if ged==1 378. replace ihigrdc = 12 if grade92>=40 & grade92<=42 & yrcoll==1 379. replace ihigrdc = 13 if grade92>=40 & grade92<=42 & yrcoll==2 380. replace ihigrdc = 14 if grade92>=40 & grade92<=42 & yrcoll==3 381. replace ihigrdc = 15 if grade92>=40 & grade92<=42 & yrcoll==4 382. replace ihigrdc = 16 if grade92>=40 & grade92<=42 & yrcoll==5 383. replace ihigrdc = 16 if grade92==43 & grprof==2 384. replace ihigrdc = 17 if grade92==43 & gr6cor==2 385. replace ihigrdc = 18 if grade92==43 & gr6cor==1 386. replace ihigrdc = 17 if grade92==44 & ms123==1 387. replace ihigrdc = 18 if grade92==44 & ms123>=2 & ms123<. 388. replace ihigrdc = 18 if grade92==45 | grade92==46 389. } 390. if inlist( `1', 1992 , 1993 ) { 391. drop gradecp gradeat 392. } 393. if `1' == 1995 { 394. replace relref94 = . if intmonth > 2 395. replace relref95 = . if intmonth < 3 396. } 397. if inlist( `1', 1996 , 1997 ) { 398. drop relref94 399. } 400. if `1' == 1994 { 401. drop relref95 402. } 403. if `1' >= 1994 { 404. replace penatvty = . if penatvty < 0 405. replace pemntvty = . if pemntvty < 0 406. replace pefntvty = . if pefntvty < 0 407. replace prcitshp = . if prcitshp < 0 408. replace prcitflg = . if prcitflg < 0 409. } 410. if `1' > 1989 { 411. replace ethnic = . if ethnic < 0 412. replace ethnic = . if ethnic >= 10 413. } 414. if `1' >= 1994 & `1' <= 2004 { 415. replace veteran = . if veteran < 0 416. } 417. if `1' >= 2003 & `1' <= 2004 { 418. drop vet1-vet4 419. } 420. if `1' == 2005 { 421. display "replacing veteran Jan-July 2005" 422. replace veteran = . if veteran < 0 & intmonth <= 7 423. display "replacing vet1-vet4 if intmonth <= 7 " 424. replace vet1 = . if intmonth <= 7 425. replace vet2 = . if intmonth <= 7 426. replace vet3 = . if intmonth <= 7 427. replace vet4 = . if intmonth <= 7 428. } 429. if `1' == 2005 { 430. replace veteran = . if intmonth >= 8 431. replace vet1 = . if vet1 < 0 & intmonth >= 8 432. replace vet2 = . if vet2 < 0 & intmonth >= 8 433. replace vet3 = . if vet3 < 0 & intmonth >= 8 434. replace vet4 = . if vet4 < 0 & intmonth >= 8 435. } 436. if `1' >= 2006 { 437. drop veteran 438. replace vet1=. if vet1<0 439. replace vet2=. if vet2<0 440. replace vet3=. if vet3<0 441. replace vet4=. if vet4<0 442. } 443. * Employment . display "Employment" 444. if `1' >= 1994 { 445. replace selfproxy = . if selfproxy<0 446. replace dwrsn = . if dwrsn<0 447. replace otc = . if otc<0 448. } 449. if `1' >= 1994 & `1' <= 2002 { 450. replace occ80 = . if occ80 <0 451. replace ind80 = . if ind80 < 10 452. replace class94 = . if class94<0 453. } 454. if `1' >= 2000 { 455. replace occ00 = . if occ00 <0 456. replace ind02 = . if ind02 < 10 457. replace class94 = . if class94<0 458. } 459. #delimit ; delimiter now ; . ; . display "docc80" ; 460. if `1' >= 1983 & `1' <= 2002 { > display "generate int docc80=occ80;"; 461. generate int docc80=occ80; 462. display "recode docc80"; 463. recode docc80 (1/6=1) (7/22=2) (23/37=3) (44/59=4) (64/68=5) (69/83=6) (84/89=7) > (95/106=8) (113/154=9) (155/159=10) (178/179=11) (43 63 163/177 183/199=12) > (203/208=13) (213/225=14) (226/235=15) (243=16) (253/257=17) (258/259=18) > (263/278=19) (283/285=20) (303/307=21) (308/309=22) (313/315=23) (337/344=24) > (354/357=25) (316/336 345/353 359/389=26) (403/407=27) (413/427=28) > (433/444=29) (445/447=30) (448/455=31) (456/469=32) (503/549=33) (553/599=34) > (613/699=35) (703/779=36) (783/799=37) (803/814=38) (823/859=39) (869=40) > (875/883=41) (863/868 873 874 885/889=42) (473/476=43) (477/489=44) (494/499=45) > (905=46); 464. } ; 465. display "** The renaming is part of the Census reweighting ; " ; 466. if inlist( `1', 2000 , 2001 , 2002 ) { > *display "renaming docc80 docc80p " ; 467. *rename docc80 docc80p ; . } ; 468. display "docc00" ; 469. if `1' >= 2000 { > display "generate int docc00=occ00;"; 470. generate int docc00=occ00; 471. display "recode docc00"; 472. recode docc00 (10/430=1) (500/950=2) (1000/1240=3) (1300/1560=4) (1600/1960=5) > (2000/2060=6) (2100/2150=7) (2200/2550=8) (2600/2960=9) (3000/3540=10) (3600/3650=11) > (3700/3950=12) (4000/4160=13) (4200/4250=14) (4300/4650=15) (4700/4960=16) > (5000/5930=17) (6000/6130=18) (6200/6940=19) (7000/7620=20) (7700/8960=21) > (9000/9750=22) (9840=23); 473. } ; 474. display "dind"; 475. if `1'<= 1982 { > display "`1' <= 1982: creating dind from ind70"; 476. gen dind=ind70 ; 477. recode dind (18/19=1) (17=2) (47/57=3) (67/77=4) (107/109=5) (118=6) (119/138=7) > (139/149=8) (157/168 258=9) (169=10) (177/198=11) (199/209=12) (219 =13) > (227=14) (228/238=15) (239/257=16) (259=18) (268/298=19) (299=20) > (307/318=21) (319/327=22) (328/337=23) (338/339=24) (347/369=25) > (377/378=26) (379/387=27) (388/398=28) (407/429=29) (447/449=30) (467/479=31) > (507/588=32) (607/698=33) (707/709=34) (717/718=35) > (769=36) (727/748=37) (749/759=38) (777/798=39) (807/809=40) (838=41) > (828/837 839/848=42) (877/879=44) (857/868=43) (849 869 887/897= 45) > (027 028 = 46) (907/937=52) ; 478. } ; 479. if `1' <=1991 & `1' >=1983 { > display "replacing dind for `1': `1' <=1991 & `1' >=1983"; 480. gen dind=ind80; 481. recode > dind (12/29=1) (10/11=2) (40/50=3) (60=4) (230/241=5) (242=6) (250/262=7) > (270/280=8) (281/300=9) (301=10) (310/332=11) (340/350=12) > (351=13) (352=14) (360/370=15) (371/382=16) (390=17) (391/392=18) > (100/122=19) (130=20) (132/150=21) (151/152=22) (160/162=23) (171/172=24) > (180/192=25) (200/201=26) (210/212=27) (220/222=28) > (400/432=29) (440/442=30) (450/472=31) (500/571=32) (580/691=33) (700/710=34) > (711/712=35) (761=36) (721/750=37) (751/760=38) (762/791=39) (800/810=40) > (831=41) (812/830 832/840=42) (842/860=43) (861/871=44) (841 872/893=45) > (30/32=46) (900/932=52) (991=51); 482. } ; 483. if `1' >= 1992 & `1' <= 2002 { > display "replacing dind for `1': `1' >= 1992 & `1' <= 2002 "; 484. gen dind=ind80; 485. recode > dind (12/30=1) (10/11=2) (40/50=3) (60=4) (230/241=5) (242=6) (250/262=7) > (270/280=8) (281/300=9) (301=10) (310/332=11) (340/350=12) > (351=13) (352=14) (360/370=15) (371/382=16) (390=17) (391/392=18) > (100/122=19) (130=20) (132/150=21) (151/152=22) (160/162=23) (171/172=24) > (180/192=25) (200/201=26) (210/212=27) (220/222=28) > (400/432=29) (440/442=30) (450/472=31) (500/571=32) (580/691=33) > (700/710=34) (711/712=35) (761=36) (721/750=37) (751/760=38) (762/791=39) > (800/810=40) (831=41) (812/830 832/840=42) (842/860=43) > (861/871=44) (841 872/893 =45) > (032 031 =46) > (910 922 932 900 901 921 930 931 =52) > (991=51) ; 486. }; 487. if `1' >= 2000 { > display "replacing dind for `1' >= 2000 " ; 488. gen dind02 = ind02; 489. recode > dind02 (170/180 290=1) (190/280=2) (370/490=3) (770=4) (2470/2590=5) > (2670/2990=6) (3070/3290=7) (3360/3390=8) (3470 3490=9) (3570/3690=10) > (3770/3870=11) (3890=12) (3960/3990=13) (1070/1290=14) (1370 1390=15) > (1470/1790=16) (1870/1990=17) (2070 2090=18) (2170/2290=19) (2370/2390=20) > (4070/4590=21) (4670/5790=22) (6070/6390=23) (570/690=24) (6470/6490=25) > (6570 6590=26) (6670=27) (6672/6675=28) (6680 6690=29) (6692 6695=30) > (6770 6780=31) (6870/6970=32) (6990=33) (7070=34) (7080/7190=35) > (7270/7490=36) (7570=37) (7580/7780=38) (7790=39) (7860/7890=40) > (8190=41) (7970/8180 8270 8290=42) (8370/8470=43) (8560/8590=44) (8660 8670=45) > (8680 8690=46) (8770/8890=47) (8970/9090=48) (9160/9190=49) (9290=50) > (9370/9590=51) (9890=52) ; 490. } ; 491. #delimit cr delimiter now cr . **Wages (If earnings are 0, then wage rate is missing, not zero). . display "Wages" 492. replace paidhr = . if paidhr <=0 493. replace paidhre = . if paidhre <=0 494. replace earnhr = . if earnhr <=0 495. replace earnhre = . if earnhre <=0 496. replace earnwke = . if earnwke < 0 497. if `1' < 1989 { 498. replace eligible = 2 if eligible == . 499. } 500. if `1' >= 1989 { 501. replace eligible = 2 if eligible <= 0 502. replace agri = 0 if agri==2 503. replace agri = . if agri< 0 504. replace untype = . if untype<0 505. } 506. if `1' < 1989 { 507. replace I25a = 0 if I25a ==. 508. replace I25b = 0 if I25b ==. 509. replace I25c = 0 if I25c ==. 510. replace I25d = 0 if I25d ==. 511. replace agri = . if agri< 0 512. } 513. if `1' >= 1994 { 514. replace I25a = 0 if I25a <= 3 515. replace I25b = 0 if I25b <= 3 516. *replace I25a = . if I25a < 0 . *replace I25b = . if I25b < 0 . replace earnhre = . if earnhre ==1 517. replace uhourse = . if lfsr94 >2 | lfsr94 <1 518. replace lfsr94 = . if lfsr94 < 0 519. replace laydur = . if laydur < 0 520. } 521. if `1' >= 1996 { 522. replace I25c = . if I25c < 0 523. replace I25d = . if I25d < 0 524. } 525. if `1' == 1995 { 526. replace I25c = . if I25c < 0 527. replace I25d = . if I25d < 0 528. replace I25c = . if intmonth < 9 529. replace I25d = . if intmonth < 9 530. } 531. if `1' == 1994 { 532. drop I25c I25d 533. } 534. ** Hours, Unions . display "Hours, Unions" 535. if `1' >= 1994 { 536. replace reason94 = . if reason94< 0 537. replace absent94 = . if absent94< 0 538. replace studftpt = . if studftpt< 0 539. replace schenr = . if schenr < 0 540. replace schlvl = . if schlvl < 0 541. replace ftpt94 = . if ftpt94 < 0 542. replace hourslw = . if hourslw < 0 543. replace hourslw = 99 if hourslw >99 & hourslw != . 544. replace uhourse = . if uhourse < 0 545. replace why3594 = . if why3594 < 0 546. replace unionmme = . if unionmme< 0 547. replace unioncov = . if unioncov< 0 548. } 549. . ** Save and exit . compress 550. saveold /homes/data/morg/annual/morg`2',replace 551. summarize 552. clear 553. capture ! /usr/bin/rm -f aef.dct /tmp/aef.raw 554. capture ! /bin/rm -f aef.dct /tmp/aef.raw 555. capture ! /usr/bin/chmod a+r /home/data/morg/annual/morg`2'.dta 556. capture ! /bin/chmod a+r /home/data/morg/annual/morg`2'.dta 557. capture ! /usr/bin/chmod g+w /home/data/morg/annual/morg`2'.dta 558. capture ! /bin/chmod g+w /home/data/morg/annual/morg`2'.dta 559. capture ! /usr/bin/chgrp web /home/data/morg/annual/morg`2'.dta 560. capture ! /bin/chgrp web /home/data/morg/annual/morg`2'.dta 561. 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. . . *aef2 1979 79 79_83 . *aef2 1980 80 79_83 . *aef2 1981 81 79_83 . *aef2 1982 82 79_83 . *aef2 1983 83 79_83 . *aef2 1984 84 84_88 . *aef2 1985 85 84_88 . *aef2 1986 86 84_88 . *aef2 1987 87 84_88 . *aef2 1988 88 84_88 . *aef2 1989 89 89_93 . *aef2 1990 90 89_93 . *aef2 1991 91 89_93 . *aef2 1992 92 89_93 . *aef2 1993 93 89_93 . *aef2 1994 94 94_97 . *aef2 1995 95 94_97 . *aef2 1996 96 94_97 . *aef2 1997 97 94_97 . *aef2 1998 98 98_02 . *aef2 1999 99 98_02 . *aef2 2000 00 98_02 . *aef2 2001 01 98_02 . *aef2 2002 02 98_02 . *aef2 2003 03 03 . *aef2 2004 04 03 . *aef2 2005 05 03 . *aef2 2006 06 03 . *aef2 2007 07 03 . *aef2 2008 08 03 . *aef2 2009 09 03 . *aef2 2010 10 03 . aef2 2011 11 03 dct_name aef03.dbd raw_name=../raw/morg11