------------------------------------------------------------------------------------ log: /disk/nber10/SCCS/morg/sources/ljubica.log log type: text opened on: 29 Sep 2009, 12:41:14 . 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, 200 > 3-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'" . *display "raw_name `raw_name'" . if `1' <= 1993 { 4. !zcat /homes/data/cps-basic/cpsb`2'??.Z |tr "\-A" " " >/tmp/aef.raw 5. } 6. if `1' >= 1994 { 7. !zcat /homes/data/cps-basic/cpsb`2'??.Z >/tmp/aef.raw 8. } 9. *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.d > ct . ! cat /home/data/morg/sources/aef`3'.dbd >./aef.dct 10. *quietly infile using aef.dct if age>15&age!=. , using("/tmp/aef.raw") clear . quietly infile using aef.dct , using("/tmp/aef.raw") clear 11. gen recnum=_n 12. keep if minsamp==4 | minsamp==8 13. quietly describe 14. display "obs " r(N) 15. quietly count if age<=15 16. display "# of persons with age<=15 `r(N)'" 17. quietly count if age==. 18. display "# of non-interview records `r(N)'" 19. tab age , missing 20. tab age if age==. , missing 21. tab age if age<=15 22. keep if age>15 23. keep if age!=. 24. quietly describe 25. display "obs " r(N) " after keeping age>15&age!=. " 26. display "infile successful" 27. #delimit cr delimiter now cr . generate int year = `1' 28. *summarize . tab intmonth if `1'==2005 29. ** Revised Census 2000-based Weights. Impact employment and union variables . if inlist( `1', 2000 , 2001 , 2002 ) { 30. gen id = _n 31. local rwlist qstnum intmonth year occurnum 32. sort `rwlist' 33. quietly describe 34. display "total obs pre-revise `1' " r(N) 35. saveold /homes/data/morg/annual/rw/annual, replace 36. clear 37. rw `2' jan 1 38. rw `2' feb 2 39. rw `2' mar 3 40. rw `2' apr 4 41. rw `2' may 5 42. rw `2' jun 6 43. rw `2' jul 7 44. rw `2' aug 8 45. rw `2' sep 9 46. rw `2' oct 10 47. rw `2' nov 11 48. rw `2' dec 12 49. local monlist feb mar apr may jun jul aug sep oct nov dec 50. clear 51. display "using jan" 52. use /homes/data/morg/annual/rw/jan 53. foreach mon in `monlist' { 54. append using /home/data/morg/annual/rw/`mon' 55. } 56. quietly describe 57. display "total obs post-revise" r(N) 58. display "start renaming" 59. rename neio1icd ind02 60. rename ntio1ocd occ00 61. replace occ00 = . if occ00 < 0 62. rename class94 class94p 63. replace class94p = . if class94p<0 64. . rename neio1cow class94 65. rename earnwt earnwtp 66. rename nworwgt earnwt 67. rename weight weightp 68. rename nwsswgt weight 69. display "done renaming" 70. display "drop 2000" 71. if `1' == 2000 { 72. drop neerncov neernlab 73. } 74. display "rename 2001-2002" 75. if inlist( `1' , 2001 , 2002 ) { 76. rename unioncov unioncop 77. replace unioncop = . if unioncop < 0 78. rename neerncov unioncov 79. rename unionmme unionmep 80. replace unionmep = . if unionmep < 0 81. rename neernlab unionmme 82. } 83. sort id 84. drop id _merge 85. } 86. . * Miscellaneous (record keeping) variables . if `1' == 1994 { 87. replace hhid = hhid94 88. drop hhid94 89. } 90. if `1'== 1995 { 91. replace hhid = hhid94 if intmonth<9 92. drop hhid94 93. } 94. if inlist( `1', 1996 , 1997 ) { 95. drop hhid94 96. } 97. replace hurespli =. if hurespli <0 98. if `1'>=2003 & `1'<=2006 { 99. drop linedad 100. drop linemom 101. } 102. if `1'>=2007 { 103. replace linedad=. if linedad<0 104. replace linemom=. if linemom<0 105. } 106. if ( inlist(`1',2003,2004) | `1'>=2007 ) { 107. drop hurhhscrn 108. drop purkat1 109. drop purkat2 110. } 111. if `1'==2005 { 112. replace hurhhscrn=. if intmonth<=10 | hurhhscrn<0 113. replace purkat1=. if intmonth<=10 | purkat1<0 114. replace purkat2=. if intmonth<=10 | purkat2<0 115. } 116. if `1'==2006 { 117. replace hurhhscrn=. if hurhhscrn<0 118. replace purkat1=. if purkat2<0 119. replace purkat2=. if purkat2<0 120. . } 121. ************************************************** . ** Creating time-series month/year from the first month-in-sample . generate ym_file = ym(year,intmonth) 122. label variable ym_file "time series month from original data" 123. generate ym = ym_file 124. label variable ym "time series month of first month-in-sample" 125. replace ym = ym - 1 if minsamp == 2 126. replace ym = ym - 2 if minsamp == 3 127. replace ym = ym - 3 if minsamp == 4 128. replace ym = ym - 13 if minsamp == 5 129. replace ym = ym - 14 if minsamp == 6 130. replace ym = ym - 15 if minsamp == 7 131. replace ym = ym - 16 if minsamp == 8 132. ************************************************** . * Geography . display "Geography" 133. if `1'==2004 { 134. display "replace serial" 135. replace serial = serial04 if intmonth >= 5 136. replace hrsample = "" if intmonth >= 5 137. replace hhnum = hhnum04 if intmonth >= 5 138. display "replace cmsacode" 139. replace cmsacode = . if intmonth >= 5 140. display "replace msafips" 141. replace msafips = . if intmonth >= 5 142. display "replace smsa93" 143. replace smsa93 = . if smsa93<2 & intmonth<=4 144. replace smsa93 = . if intmonth >= 5 145. display "replacing smsa04 in May 2004 and later" 146. replace smsa04 = . if smsa04<2 & intmonth >= 5 147. } 148. if `1' == 2005 { 149. replace serial = serial04 150. replace hrsample ="" 151. replace smsa04 = . if smsa04<2 & intmonth >= 5 152. } 153. if `1' >= 2005 { 154. replace hhnum = hhnum04 155. display "dropping cmsacode msafips smsa93" 156. drop cmsacode msafips smsa93 157. } 158. if `1' == 2003 { 159. display "dropping non-2003 variables" 160. drop cbsafips smsa04 serial04 hhnum04 hrhhid2 161. } 162. if `1'==2004 { 163. display "replacing pre-May 2004 variables" 164. replace cbsafips = . if intmonth <=4 165. replace smsa04 = . if intmonth <=4 166. replace hrhhid2 ="" if intmonth <=4 167. } 168. if `1' >= 2004 { 169. drop serial04 hhnum04 170. } 171. if `1' >= 1996 & `1' <= 2003 { 172. replace smsa93 = . if smsa93<2 173. } 174. display "smsasize = . if smsasize <=0" 175. capture replace smsasize = . if smsasize <=0 176. if `1' == 1995 { 177. replace smsastat = smsa995 if intmonth>8 178. replace icntcity = icntct94 if intmonth<9 179. replace centcity = centcitx if intmonth<9 180. replace smsa93 = . if intmonth>=9 & smsa93<2 181. replace smsa93 = . if intmonth<9 182. drop pmsarank 183. dis "gen smsa80" 184. generate smsa80 = smsasize 185. dis "rep smsa80" 186. replace smsa80 = . if intmonth >= 10 187. dis "replace county" 188. replace county = . if county < 0 189. dis "drop county" 190. if intmonth<9 { 191. drop county 192. } 193. } 194. display "inlisting 96 97" 195. if inlist( `1', 1996 , 1997 ) { 196. replace smsastat = smsa995 197. } 198. display "replace smsastat = . if smsastat==3 | smsastat<0" 199. replace smsastat = . if smsastat==3 | smsastat<0 200. if `1' == 1994 { 201. drop smsa93 202. replace centcity = centcitx 203. replace icntcity = icntct94 204. replace pmsarank = . if intmonth > 3 205. replace pmsarank = . if pmsarank <= 0 206. replace cmsarank = . if intmonth > 3 207. } 208. if inlist( `1', 1996 , 1997 ) { 209. drop pmsarank 210. } 211. if `1' >= 1994 & `1' <= 1997 { 212. drop centcitx icntct94 smsa995 213. } 214. if `1' >= 1994 { 215. replace peinusyr = . if peinusyr < 0 216. } 217. display "replace centcity = . if centcity==4 | centcity<=0" 218. replace centcity = . if centcity==4 | centcity<=0 219. if `1' >= 1986 & `1' < 1994 { 220. replace pmsarank = . if pmsarank<=0 221. } 222. if `1' >= 1995 & `1' <= 1997 { 223. drop cmsarank 224. } 225. if `1' >= 1986 { 226. replace icntcity = . if icntcity<=0 227. } 228. if `1' > 1984 & `1' < 1995 { 229. replace cmsarank = . if cmsarank<=0 230. } 231. if `1' >= 1989 & `1' <= 2004 { 232. replace msafips = . if msafips <=0 233. replace cmsacode = . if cmsacode<=0 234. } 235. ** 1970 occupation variables are not correct on morg83.raw . if `1' == 1983 { 236. drop docc70 occ70 237. } 238. if `1' == 1985 { 239. replace smsarank = . if intmonth > 9 240. } 241. if `1' == 1984 { 242. display "drop icntcity pmsarank cmsarank" 243. drop icntcity pmsarank cmsarank 244. } 245. if `1' == 1985 & intmonth < 10 { 246. drop icntcity pmsarank cmsarank 247. } 248. if `1' == 1994 { 249. replace cmsarank = . if intmonth>3 250. } 251. display "replace smsasize=. if smsasize<=0" 252. **should line below be commented out??? . capture replace smsasize=. if smsasize<=0 253. if `1' < 1985 { 254. display "generate byte smsa70 = smsasize" 255. generate byte smsa70 = smsasize 256. } 257. if `1' > 1985 & `1' < 1995 { 258. generate byte smsa80 = smsasize 259. } 260. if `1' == 1985 { 261. generate byte smsa70 = smsasize if intmonth<10 262. } 263. if `1' == 1985 { 264. generate byte smsa80 = smsasize if intmonth>9 265. } 266. display "drop smsasize" 267. capture drop smsasize 268. if `1' > 1985 & `1' < 1989 { 269. drop smsarank 270. } 271. if `1' < 1983 { 272. display "drop unioncov unionmme occ80 ind80" 273. drop unioncov unionmme occ80 ind80 274. } 275. . * Demography . display "Demography" 276. if `1' > 1983 & `1' < 1994 { 277. replace ownchild = . if ownchild ==0 278. replace ownchild = ownchild - 1 279. generate int ch613=chldpres 280. generate int ch1417=chldpres 281. } 282. display "if `1' > 1983 & `1' < 1989 {" 283. if `1' > 1983 & `1' < 1989 { 284. generate int ch05= chldpres 285. recode ch05 (4 6/8 = 1) (0/3 5 = 0) 286. recode ch613 (3 5 7/8 = 1) (0/2 4 6 = 0) 287. recode ch1417 (2 5/6 8 =1) (0/1 3/4 7 = 0) 288. } 289. if `1' > 1988 & `1' < 1994 { 290. display "if `1' > 1988 & `1' < 1994 {" 291. generate int ch02 = chldpres 292. generate int ch35 = chldpres 293. recode ch02 (2 6/8 12/14 16 = 1) (0/1 3/5 9/11 15 = 0) 294. recode ch35 (3 6 9/10 12/13 15/16 = 1) (0/2 4/5 7/8 11 14 = 0) 295. recode ch613 (4 7 9 11/12 14/16 = 1) (0/3 5/6 8 10 13 = 0) 296. recode ch1417 (5 8 10/11 13/16 = 1) (0/4 6/7 9 12 = 0 ) 297. generate int ch05 = ch02 298. replace ch05 = ch35 if ch35 == 1 299. label variable ch02 "Children 0-2" 300. label variable ch35 "Children 3-5" 301. } 302. if `1' > 1983 & `1' < 1994 { 303. display "if `1' > 1983 & `1' < 1994 {" 304. label variable ch05 "Children 0-5" 305. label variable ch613 "Children 6-13" 306. label variable ch1417 "Children 6-17" 307. } 308. if `1' >= 1994 & `1' <= 1996 { 309. drop prpertyp 310. } 311. if `1' >= 1997 { 312. replace prpertyp=. if prpertyp<0 313. } 314. if `1' == 1998 { 315. drop ownchild chldpres 316. } 317. if `1' >= 1999 { 318. replace ownchild = . if ownchild < 0 319. replace chldpres = . if chldpres < 0 320. generate int ch02 = chldpres 321. generate int ch35 = chldpres 322. generate int ch613 = chldpres 323. generate int ch1417 = chldpres 324. recode ch02 (1 5/7 11/13 15 = 1) (0 2/4 8/10 14 = 0) 325. recode ch35 (2 5 8/9 11/12 14/15 = 1) (0/1 3/4 6/7 10 13 =0) 326. recode ch613 (3 6 8 10/11 13/15 = 1) (0/2 4/5 7 9 12 = 0) 327. recode ch1417 (4 7 9/10 12/15 = 1) (0/3 5/6 8 11 = 0) 328. generate int ch05 = ch02 329. replace ch05 = ch35 if ch35 == 1 330. } 331. . if `1' == 1999 { 332. replace ownchild = . if intmonth < 10 333. replace chldpres = . if intmonth < 10 334. replace ch613 = . if intmonth < 10 335. replace ch1417 = . if intmonth < 10 336. replace ch05 = . if intmonth < 10 337. replace ch02 = . if intmonth < 10 338. replace ch35 = . if intmonth < 10 339. } 340. if `1' > 1988 & `1' < 1992 { 341. drop grade92 342. } 343. if `1' < 1989 { 344. replace gradeat = gradeat - 1 345. replace marital = 7 if marital==5 346. } 347. if `1' > 1991 { 348. replace grade92 = . if grade92 < 0 349. } 350. if `1' >= 1998 { 351. replace ged = . if ged < 0 352. replace gedhigr = . if gedhigr < 0 353. replace yrcoll = . if yrcoll < 0 354. replace grprof = . if grprof < 0 355. replace gr6cor = . if gr6cor < 0 356. replace ms123 = . if ms123 < 0 357. generate double ihigrdc = . 358. ** Jaeger . label var ihigrdc "Imputed highest grade completed" 359. replace ihigrdc = 0 if grade92==31 360. replace ihigrdc = 2.5 if grade92==32 361. replace ihigrdc = 5.5 if grade92==33 362. replace ihigrdc = 7.5 if grade92==34 363. replace ihigrdc = 9 if grade92==35 364. replace ihigrdc =10 if grade92==36 365. replace ihigrdc =11 if grade92==37 366. replace ihigrdc =12 if grade92==38 367. replace ihigrdc = 0 if grade92==39 & ged==2 & gedhigr==1 368. replace ihigrdc = 2.5 if grade92==39 & ged==2 & gedhigr==2 369. replace ihigrdc = 5.5 if grade92==39 & ged==2 & gedhigr==3 370. replace ihigrdc = 7.5 if grade92==39 & ged==2 & gedhigr==4 371. replace ihigrdc = 9 if grade92==39 & ged==2 & gedhigr==5 372. replace ihigrdc = 10 if grade92==39 & ged==2 & gedhigr==6 373. replace ihigrdc = 11 if grade92==39 & ged==2 & gedhigr==7 374. replace ihigrdc = 12 if grade92==39 & ged==2 & gedhigr==8 375. replace ihigrdc = 12 if ged==1 376. replace ihigrdc = 12 if grade92>=40 & grade92<=42 & yrcoll==1 377. replace ihigrdc = 13 if grade92>=40 & grade92<=42 & yrcoll==2 378. replace ihigrdc = 14 if grade92>=40 & grade92<=42 & yrcoll==3 379. replace ihigrdc = 15 if grade92>=40 & grade92<=42 & yrcoll==4 380. replace ihigrdc = 16 if grade92>=40 & grade92<=42 & yrcoll==5 381. replace ihigrdc = 16 if grade92==43 & grprof==2 382. replace ihigrdc = 17 if grade92==43 & gr6cor==2 383. replace ihigrdc = 18 if grade92==43 & gr6cor==1 384. replace ihigrdc = 17 if grade92==44 & ms123==1 385. replace ihigrdc = 18 if grade92==44 & ms123>=2 & ms123<. 386. replace ihigrdc = 18 if grade92==45 | grade92==46 387. } 388. if inlist( `1', 1992 , 1993 ) { 389. drop gradecp gradeat 390. } 391. if `1' == 1995 { 392. replace relref94 = . if intmonth > 2 393. replace relref95 = . if intmonth < 3 394. } 395. if inlist( `1', 1996 , 1997 ) { 396. drop relref94 397. } 398. if `1' == 1994 { 399. drop relref95 400. } 401. if `1' >= 1994 { 402. replace penatvty = . if penatvty < 0 403. replace pemntvty = . if pemntvty < 0 404. replace pefntvty = . if pefntvty < 0 405. replace prcitshp = . if prcitshp < 0 406. replace prcitflg = . if prcitflg < 0 407. } 408. if `1' > 1989 { 409. replace ethnic = . if ethnic < 0 410. replace ethnic = . if ethnic >= 10 411. } 412. if `1' >= 1994 & `1' <= 2004 { 413. replace veteran = . if veteran < 0 414. } 415. if `1' >= 2003 & `1' <= 2004 { 416. drop vet1-vet4 417. } 418. if `1' == 2005 { 419. display "replacing veteran Jan-July 2005" 420. replace veteran = . if veteran < 0 & intmonth <= 7 421. display "replacing vet1-vet4 if intmonth <= 7 " 422. replace vet1 = . if intmonth <= 7 423. replace vet2 = . if intmonth <= 7 424. replace vet3 = . if intmonth <= 7 425. replace vet4 = . if intmonth <= 7 426. } 427. if `1' == 2005 { 428. replace veteran = . if intmonth >= 8 429. replace vet1 = . if vet1 < 0 & intmonth >= 8 430. replace vet2 = . if vet2 < 0 & intmonth >= 8 431. replace vet3 = . if vet3 < 0 & intmonth >= 8 432. replace vet4 = . if vet4 < 0 & intmonth >= 8 433. } 434. if `1' >= 2006 { 435. drop veteran 436. replace vet1=. if vet1<0 437. replace vet2=. if vet2<0 438. replace vet3=. if vet3<0 439. replace vet4=. if vet4<0 440. } 441. * Employment . display "Employment" 442. if `1' >= 1994 { 443. replace selfproxy = . if selfproxy<0 444. replace dwrsn = . if dwrsn<0 445. replace otc = . if otc<0 446. } 447. if `1' >= 1994 & `1' <= 2002 { 448. replace occ80 = . if occ80 <0 449. replace ind80 = . if ind80 < 10 450. replace class94 = . if class94<0 451. } 452. if `1' >= 2000 { 453. replace occ00 = . if occ00 <0 454. replace ind02 = . if ind02 < 10 455. replace class94 = . if class94<0 456. } 457. #delimit ; delimiter now ; . ; . display "docc80" ; 458. if `1' >= 1983 & `1' <= 2002 { > display "generate int docc80=occ80;"; 459. generate int docc80=occ80; 460. display "recode docc80"; 461. 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=4 > 5) > (905=46); 462. } ; 463. display "** The renaming is part of the Census reweighting ; " ; 464. if inlist( `1', 2000 , 2001 , 2002 ) { > *display "renaming docc80 docc80p " ; 465. *rename docc80 docc80p ; . } ; 466. display "docc00" ; 467. if `1' >= 2000 { > display "generate int docc00=occ00;"; 468. generate int docc00=occ00; 469. display "recode docc00"; 470. recode docc00 (10/430=1) (500/950=2) (1000/1240=3) (1300/1560=4) (1600/196 > 0=5) > (2000/2060=6) (2100/2150=7) (2200/2550=8) (2600/2960=9) (3000/3540=10) (3600/3 > 650=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); 471. } ; 472. display "dind"; 473. if `1'<= 1982 { > display "`1' <= 1982: creating dind from ind70"; 474. gen dind=ind70 ; 475. recode dind (18/19=1) (17=2) (47/57=3) (67/77=4) (107/109=5) (118=6) (119/1 > 38=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) ; 476. } ; 477. if `1' <=1991 & `1' >=1983 { > display "replacing dind for `1': `1' <=1991 & `1' >=1983"; 478. gen dind=ind80; 479. 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); 480. } ; 481. if `1' >= 1992 & `1' <= 2002 { > display "replacing dind for `1': `1' >= 1992 & `1' <= 2002 "; 482. gen dind=ind80; 483. 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) ; 484. }; 485. if `1' >= 2000 { > display "replacing dind for `1' >= 2000 " ; 486. gen dind02 = ind02; 487. 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) (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) ; 488. } ; 489. #delimit cr delimiter now cr . **Wages (If earnings are 0, then wage rate is missing, not zero). . display "Wages" 490. replace paidhr = . if paidhr <=0 491. replace paidhre = . if paidhre <=0 492. replace earnhr = . if earnhr <=0 493. replace earnhre = . if earnhre <=0 494. replace earnwke = . if earnwke < 0 495. if `1' < 1989 { 496. replace eligible = 2 if eligible == . 497. } 498. if `1' >= 1989 { 499. replace eligible = 2 if eligible <= 0 500. replace agri = 0 if agri==2 501. replace agri = . if agri< 0 502. replace untype = . if untype<0 503. } 504. if `1' < 1989 { 505. replace I25a = 0 if I25a ==. 506. replace I25b = 0 if I25b ==. 507. replace I25c = 0 if I25c ==. 508. replace I25d = 0 if I25d ==. 509. replace agri = . if agri< 0 510. } 511. if `1' >= 1994 { 512. replace I25a = 0 if I25a <= 3 513. replace I25b = 0 if I25b <= 3 514. *replace I25a = . if I25a < 0 . *replace I25b = . if I25b < 0 . replace earnhre = . if earnhre ==1 515. replace uhourse = . if lfsr94 >2 | lfsr94 <1 516. replace lfsr94 = . if lfsr94 < 0 517. } 518. if `1' >= 1996 { 519. replace I25c = . if I25c < 0 520. replace I25d = . if I25d < 0 521. } 522. if `1' == 1995 { 523. replace I25c = . if I25c < 0 524. replace I25d = . if I25d < 0 525. replace I25c = . if intmonth < 9 526. replace I25d = . if intmonth < 9 527. } 528. if `1' == 1994 { 529. drop I25c I25d 530. } 531. ** Hours, Unions . display "Hours, Unions" 532. if `1' >= 1994 { 533. replace reason94 = . if reason94< 0 534. replace absent94 = . if absent94< 0 535. replace studftpt = . if studftpt< 0 536. replace schenr = . if schenr < 0 537. replace schlvl = . if schlvl < 0 538. replace ftpt94 = . if ftpt94 < 0 539. replace hourslw = . if hourslw < 0 540. replace hourslw = 99 if hourslw >99 & hourslw != . 541. replace uhourse = . if uhourse < 0 542. replace why3594 = . if why3594 < 0 543. replace unionmme = . if unionmme< 0 544. replace unioncov = . if unioncov< 0 545. } 546. . ** Save and exit . compress 547. saveold ljubica`2',replace 548. summarize 549. clear 550. capture ! /usr/bin/rm -f aef.dct /tmp/aef.raw 551. capture ! /bin/rm -f aef.dct /tmp/aef.raw 552. capture ! /usr/bin/chmod a+r /home/data/morg/annual/morg`2'.dta 553. capture ! /bin/chmod a+r /home/data/morg/annual/morg`2'.dta 554. capture ! /usr/bin/chmod g+w /home/data/morg/annual/morg`2'.dta 555. capture ! /bin/chmod g+w /home/data/morg/annual/morg`2'.dta 556. capture ! /usr/bin/chgrp web /home/data/morg/annual/morg`2'.dta 557. capture ! /bin/chgrp web /home/data/morg/annual/morg`2'.dta 558. 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 (1422018 observations deleted) obs 472016 # of persons with age<=15 105299 # of non-interview records 38632 Age | Freq. Percent Cum. ------------+----------------------------------- 0 | 6,358 1.35 1.35 1 | 6,607 1.40 2.75 2 | 6,948 1.47 4.22 3 | 6,826 1.45 5.66 4 | 6,870 1.46 7.12 5 | 6,686 1.42 8.54 6 | 6,671 1.41 9.95 7 | 6,664 1.41 11.36 8 | 6,630 1.40 12.77 9 | 6,543 1.39 14.15 10 | 6,632 1.41 15.56 11 | 6,415 1.36 16.92 12 | 6,654 1.41 18.33 13 | 6,598 1.40 19.72 14 | 6,106 1.29 21.02 15 | 6,091 1.29 22.31 16 | 6,013 1.27 23.58 17 | 5,633 1.19 24.78 18 | 5,467 1.16 25.93 19 | 5,069 1.07 27.01 20 | 5,207 1.10 28.11 21 | 5,543 1.17 29.29 22 | 5,829 1.23 30.52 23 | 5,882 1.25 31.77 24 | 5,964 1.26 33.03 25 | 5,927 1.26 34.29 26 | 5,956 1.26 35.55 27 | 6,149 1.30 36.85 28 | 6,694 1.42 38.27 29 | 6,802 1.44 39.71 30 | 7,322 1.55 41.26 31 | 7,122 1.51 42.77 32 | 7,473 1.58 44.35 33 | 7,283 1.54 45.90 34 | 7,175 1.52 47.42 35 | 7,398 1.57 48.98 36 | 7,266 1.54 50.52 37 | 7,190 1.52 52.05 38 | 7,098 1.50 53.55 39 | 6,864 1.45 55.00 40 | 7,001 1.48 56.49 41 | 6,560 1.39 57.88 42 | 6,382 1.35 59.23 43 | 6,220 1.32 60.55 44 | 6,117 1.30 61.84 45 | 6,317 1.34 63.18 46 | 6,224 1.32 64.50 47 | 5,036 1.07 65.57 48 | 4,820 1.02 66.59 49 | 4,985 1.06 67.64 50 | 5,260 1.11 68.76 51 | 4,618 0.98 69.74 52 | 4,225 0.90 70.63 53 | 3,988 0.84 71.48 54 | 3,951 0.84 72.31 55 | 3,888 0.82 73.14 56 | 3,684 0.78 73.92 57 | 3,572 0.76 74.67 58 | 3,655 0.77 75.45 59 | 3,437 0.73 76.18 60 | 3,519 0.75 76.92 61 | 3,644 0.77 77.69 62 | 3,514 0.74 78.44 63 | 3,638 0.77 79.21 64 | 3,481 0.74 79.95 65 | 3,703 0.78 80.73 66 | 3,606 0.76 81.50 67 | 3,500 0.74 82.24 68 | 3,478 0.74 82.97 69 | 3,267 0.69 83.67 70 | 3,416 0.72 84.39 71 | 3,181 0.67 85.06 72 | 3,178 0.67 85.74 73 | 2,900 0.61 86.35 74 | 2,610 0.55 86.90 75 | 2,713 0.57 87.48 76 | 2,227 0.47 87.95 77 | 2,192 0.46 88.41 78 | 2,100 0.44 88.86 79 | 1,921 0.41 89.27 80 | 1,758 0.37 89.64 81 | 1,569 0.33 89.97 82 | 1,463 0.31 90.28 83 | 1,351 0.29 90.57 84 | 1,082 0.23 90.80 85 | 953 0.20 91.00 86 | 803 0.17 91.17 87 | 654 0.14 91.31 88 | 588 0.12 91.43 89 | 460 0.10 91.53 90 | 1,350 0.29 91.82 . | 38,632 8.18 100.00 ------------+----------------------------------- Total | 472,016 100.00 Age | Freq. Percent Cum. ------------+----------------------------------- . | 38,632 100.00 100.00 ------------+----------------------------------- Total | 38,632 100.00 Age | Freq. Percent Cum. ------------+----------------------------------- 0 | 6,358 6.04 6.04 1 | 6,607 6.27 12.31 2 | 6,948 6.60 18.91 3 | 6,826 6.48 25.39 4 | 6,870 6.52 31.92 5 | 6,686 6.35 38.27 6 | 6,671 6.34 44.60 7 | 6,664 6.33 50.93 8 | 6,630 6.30 57.23 9 | 6,543 6.21 63.44 10 | 6,632 6.30 69.74 11 | 6,415 6.09 75.83 12 | 6,654 6.32 82.15 13 | 6,598 6.27 88.42 14 | 6,106 5.80 94.22 15 | 6,091 5.78 100.00 ------------+----------------------------------- Total | 105,299 100.00 (105299 observations deleted) (38632 observations deleted) obs 328085 after keeping age>15&age!=. infile successful no observations (0 real changes made) (0 real changes made) (0 real changes made) (163478 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) (164607 real changes made) Geography smsasize = . if smsasize <=0 inlisting 96 97 replace smsastat = . if smsastat==3 | smsastat<0 (5600 real changes made, 5600 to missing) replace centcity = . if centcity==4 | centcity<=0 (60686 real changes made, 60686 to missing) (217275 real changes made, 217275 to missing) (310766 real changes made, 310766 to missing) (102816 real changes made, 102816 to missing) (106017 real changes made, 106017 to missing) (214074 real changes made, 214074 to missing) replace smsasize=. if smsasize<=0 (102816 missing values generated) drop smsasize Demography (64625 real changes made, 64625 to missing) (263460 real changes made) if 1993 > 1983 & 1993 < 1989 { if 1993 > 1988 & 1993 < 1994 { (ch02: 263460 changes made) (ch35: 263460 changes made) (ch613: 263460 changes made) (ch1417: 263460 changes made) (20602 real changes made) if 1993 > 1983 & 1993 < 1994 { (0 real changes made) (0 real changes made) (274 real changes made, 274 to missing) Employment docc80 (82443 missing values generated) recode docc80 (docc80: 245642 changes made) ** The renaming is part of the Census reweighting ; docc00 dind (82443 missing values generated) (dind: 245642 changes made) Wages (0 real changes made) (0 real changes made) (174 real changes made, 174 to missing) (1 real change made, 1 to missing) (0 real changes made) (151922 real changes made) (238428 real changes made) (0 real changes made) (0 real changes made) Hours, Unions ym_file was float now int ym was float now int ch613 was int now byte ch1417 was int now byte ch02 was int now byte ch35 was int now byte ch05 was int now byte docc80 was int now byte dind was float now byte file ljubica93.dta saved Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- intmonth | 328085 6.493473 3.454551 1 12 hhnum | 327739 1.084082 .3074319 1 7 hurespli | 326800 1.599067 .8271617 1 7 minsamp | 328085 6.006882 1.999991 4 8 state | 328085 50.99566 26.0027 11 95 -------------+-------------------------------------------------------- stfips | 328085 28.6916 14.89029 1 56 centcity | 267399 2.04549 .7680071 1 3 msafips | 222068 4422.927 2542.033 80 9340 pmsarank | 110810 1.761763 1.515316 1 12 cmsarank | 225269 43.06108 54.62925 1 252 -------------+-------------------------------------------------------- cmsacode | 114011 51.44726 25.24713 7 91 smsastat | 322485 1.264257 .4409376 1 2 icntcity | 17319 1.155898 .4471797 1 4 hhid | 0 sex | 328085 1.53075 .4990543 1 2 -------------+-------------------------------------------------------- veteran | 326517 5.555891 1.247842 1 6 grade92 | 328085 39.39729 2.855713 31 46 doinglw | 325960 3.027267 2.530032 1 8 hourslwa | 189167 39.17036 13.91672 0 99 uhours35 | 47485 1.696262 .4598757 1 2 -------------+-------------------------------------------------------- why35lw | 47635 10.15337 4.05454 1 15 class | 245999 1.983691 1.768913 1 8 uhours | 173182 38.21328 11.13179 0 99 paidhr | 172937 1.392785 .488371 1 2 earnhr | 91446 912.724 515.767 1 9999 -------------+-------------------------------------------------------- uearnwk | 146828 460.4223 341.8794 0 1999 unionmm | 172802 1.842189 .3645644 1 2 unioncov | 146016 1.970202 .1700305 1 2 studftpt | 21396 1.09212 .2892021 1 2 lineno | 328085 1.733429 1.01524 1 36 -------------+-------------------------------------------------------- relaref | 328085 3.085828 2.243243 1 10 age | 328085 43.95019 18.24052 16 90 marital | 328085 3.133642 2.588896 1 7 race | 328085 1.234183 .6710871 1 5 activlwr | 326517 3.041162 2.540762 1 8 -------------+-------------------------------------------------------- hourslw | 189354 39.203 13.88066 1 99 reasonlw | 47849 10.13118 4.065747 1 15 absentlw | 12805 3.6549 2.698855 1 8 ind80 | 245642 577.3268 276.5838 10 991 occ80 | 245642 378.4367 245.7107 3 905 -------------+-------------------------------------------------------- classer | 247113 1.94248 1.718647 1 8 uhourse | 174595 38.27757 10.98457 1 99 paidhre | 174595 1.395155 .4888853 1 2 unionmme | 174595 1.842292 .3644679 1 2 untype | 14268 2.760583 1.228221 1 5 -------------+-------------------------------------------------------- agri | 245642 .0293679 .168836 0 1 schenr | 50276 1.564981 .4957644 1 2 schlvl | 21871 1.491884 .4999456 1 2 ethnic | 327811 7.704134 1.259929 1 9 lfsr89 | 326517 3.190379 2.794535 1 7 -------------+-------------------------------------------------------- ftpt89 | 326517 2.090418 1.293029 1 7 eligible | 326517 1.465281 .4987939 1 2 classer2 | 247113 1.741988 1.414651 1 7 earnhre | 105602 928.0515 517.1191 50 9999 earnwke | 174595 468.9893 338.1808 1 1923 -------------+-------------------------------------------------------- weight | 326517 1790.145 975.159 108.06 15077.71 earnwt | 326517 7160.603 3907.99 400.57 58618.42 famnum | 328085 .8311505 .4362089 0 6 ownchild | 263460 .874034 1.154 0 8 chldpres | 328085 2.763884 3.394483 0 16 -------------+-------------------------------------------------------- pfamrel | 328085 1.758703 1.406292 0 5 I25a | 326517 .0360533 .3780392 0 4 I25b | 326517 .0394711 .3847751 0 4 I25c | 326517 .0027104 .090133 0 3 I25d | 326517 .0898483 .5743412 0 4 -------------+-------------------------------------------------------- recnum | 328085 949051.9 546912.9 1 1894034 year | 328085 1993 0 1993 1993 ym_file | 328085 401.4935 3.454551 396 407 ym | 328085 391.9711 7.344123 380 404 smsa80 | 225269 5.226139 1.913564 2 8 -------------+-------------------------------------------------------- ch613 | 328085 .2063337 .4046735 0 1 ch1417 | 328085 .1525519 .3595556 0 1 ch02 | 328085 .0897237 .2857859 0 1 ch35 | 328085 .0952893 .2936146 0 1 ch05 | 328085 .1525184 .3595232 0 1 -------------+-------------------------------------------------------- docc80 | 245642 23.2442 12.40883 1 46 dind | 245642 31.07605 13.39511 1 52 . *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 . . exit, clear end of do-file . exit,clear