------------------------------------------------------------------------------- log: /disk/u4/SCCS/morg/sources/matchid.log log type: text opened on: 5 Mar 2003, 22:54:37 . set memory 500m (512000k) . set more 1 . program define matchid 1. #delimit cr delimiter now cr . display "Merge previous year for `1'" 2. local lastyear=2002 3. use /homes/data/morg/annual/morg`2' 4. rename match match`2' 5. rename minsamp minsamp`2' 6. egen str2 filmage = concat(mage) 7. replace filmage = "99" if mage==. 8. if `1' == 1979 { 9. gen matchp=0 10. } 11. else if ( `1' <= 2000 & `1' > 1979 ) { 12. local prevyear=`2'-1 13. if ( `1'==2000 ) { 14. local prevyear=99 15. } 16. sort matchid filmage age sex id 17. display "Merging `1' file using morg`prevyear'.dta (year<=2000)" 18. merge matchid using /homes/data/morg/annual/morg`prevyear'.dta 19. gen matchp =(_merge==3 & minsamp`2'==8) 20. } 21. else if `1' >2000 { 22. local prevyear=`1'-2001 23. sort matchid filmage age sex id 24. display "Merging `1' file using morg0`prevyear'.dta (year>2000)" 25. merge matchid using /homes/data/morg/annual/morg0`prevyear'.dta 26. gen matchp =( _merge==3 & minsamp`2'==8) 27. } 28. if (`1' > 1979 ) { 29. display "Dropping non-matches from the matchfile" 30. drop if _merge==2 31. display "Dropping the _merge variable" 32. drop _merge 33. } 34. if `1' <1999 { 35. local nextyear = `2' + 1 36. sort matchid age filmage sex id 37. display "Merging `1' file using morg`nextyear'.dta (year<2000)" 38. merge matchid using /homes/data/morg/annual/morg`nextyear'.dta 39. gen matchn =(_merge==3 & minsamp`2'==4) 40. } 41. else if ( `1' < `lastyear' & `1' >= 1999 ) { 42. local nextyear = `2' + 1 43. if ( `1' ==1999 ) { 44. local nextyear=0 45. } 46. sort matchid age filmage sex id 47. display "Merging `1' file using morg0`nextyear'.dta (year>=1999 & year > < `lastyear')" 48. merge matchid using /homes/data/morg/annual/morg0`nextyear'.dta 49. gen matchn=( _merge==3 & minsamp`2'==4) 50. } 51. else if ( `1' == `lastyear' ) { 52. gen matchn=0 53. } 54. if ( `1' < `lastyear' ) { 55. display "Dropping non-matches from the matchfile" 56. drop if _merge==2 57. display "Dropping the _merge variable" 58. drop _merge 59. } 60. gen byte match2=matchp+matchn 61. display "Eliminating 'matches' that are too far apart in age" 62. replace match2=0 if nragedif==0 63. replace match`2'=0 if nragedif==0 64. display "Eliminating 'matches' with different sex" 65. replace match2=0 if sexdif==0 66. replace match`2'=0 if sexdif==0 67. display "Eliminating 'matches' with different race" 68. replace match2=0 if racedif==0 69. replace match`2'=0 if racedif==0 70. *unab vlist: _all . *sort `vlist' . sort mym intmonth state hhid hhnum id lineno 71. quietly by mym intmonth state hhid hhnum id lineno: gen dupm = cond(_N==1, > 0,_n) 72. *quietly by `vlist': gen dupm = cond(_N==1,0,_n) . replace match2=0 if dupm>0 73. replace match`2'=0 if dupm>0 74. sum match`2' match2 75. clear 76. . end . . matchid 1979 79 79_83 Merge previous year for 1979 (203603 real changes made) Merging 1979 file using morg80.dta (year<2000) Dropping non-matches from the matchfile (263079 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3908 real changes made) (0 real changes made) Eliminating 'matches' with different sex (19 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (319 real changes made) (319 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match79 | 328687 .3628619 .4808262 0 1 match2 | 328687 .3628619 .4808262 0 1 . matchid 1980 80 79_83 Merge previous year for 1980 (122173 real changes made) Merging 1980 file using morg79.dta (year<=2000) Dropping non-matches from the matchfile (205173 observations deleted) Dropping the _merge variable Merging 1980 file using morg81.dta (year<2000) Dropping non-matches from the matchfile (227190 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5876 real changes made) (0 real changes made) Eliminating 'matches' with different sex (53 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (751 real changes made) (751 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match80 | 386609 .6582671 .4742911 0 1 match2 | 386609 .658262 .4742929 0 1 . matchid 1981 81 79_83 Merge previous year for 1981 (89114 real changes made) Merging 1981 file using morg80.dta (year<=2000) Dropping non-matches from the matchfile (248934 observations deleted) Dropping the _merge variable Merging 1981 file using morg82.dta (year<2000) Dropping non-matches from the matchfile (217272 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5166 real changes made) (0 real changes made) Eliminating 'matches' with different sex (42 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (1089 real changes made) (1089 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match81 | 364872 .7292174 .4443646 0 1 match2 | 364872 .7288364 .4445609 0 1 . matchid 1982 82 79_83 Merge previous year for 1982 (80626 real changes made) Merging 1982 file using morg81.dta (year<=2000) Dropping non-matches from the matchfile (230095 observations deleted) Dropping the _merge variable Merging 1982 file using morg83.dta (year<2000) Dropping non-matches from the matchfile (216132 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5292 real changes made) (0 real changes made) Eliminating 'matches' with different sex (42 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (1051 real changes made) (1051 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match82 | 351874 .7432035 .4368668 0 1 match2 | 351874 .7428057 .437088 0 1 . matchid 1983 83 79_83 Merge previous year for 1983 (81852 real changes made) Merging 1983 file using morg82.dta (year<=2000) Dropping non-matches from the matchfile (218471 observations deleted) Dropping the _merge variable Merging 1983 file using morg84.dta (year<2000) Dropping non-matches from the matchfile (213434 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5695 real changes made) (0 real changes made) Eliminating 'matches' with different sex (44 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (962 real changes made) (962 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match83 | 349342 .7369769 .4402755 0 1 match2 | 349342 .7366105 .4404725 0 1 . matchid 1984 84 84_88 Merge previous year for 1984 (149239 real changes made) Merging 1984 file using morg83.dta (year<=2000) Dropping non-matches from the matchfile (218317 observations deleted) Dropping the _merge variable Merging 1984 file using morg85.dta (year<2000) Dropping non-matches from the matchfile (282177 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3703 real changes made) (0 real changes made) Eliminating 'matches' with different sex (36 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (771 real changes made) (771 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match84 | 344293 .5464096 .4978422 0 1 match2 | 344293 .5460611 .4978746 0 1 . matchid 1985 85 84_88 Merge previous year for 1985 (250317 real changes made) Merging 1985 file using morg84.dta (year<=2000) Dropping non-matches from the matchfile (282426 observations deleted) Dropping the _merge variable Merging 1985 file using morg86.dta (year<2000) Dropping non-matches from the matchfile (307612 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (2066 real changes made) (0 real changes made) Eliminating 'matches' with different sex (23 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (354 real changes made) (354 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match85 | 343855 .2619098 .4396745 0 1 match2 | 343855 .2617528 .4395894 0 1 . matchid 1986 86 84_88 Merge previous year for 1986 (184989 real changes made) Merging 1986 file using morg85.dta (year<=2000) Dropping non-matches from the matchfile (313008 observations deleted) Dropping the _merge variable Merging 1986 file using morg87.dta (year<2000) Dropping non-matches from the matchfile (216835 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (4427 real changes made) (0 real changes made) Eliminating 'matches' with different sex (21 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (425 real changes made) (425 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match86 | 338411 .4334906 .4955575 0 1 match2 | 338411 .4334374 .4955504 0 1 . matchid 1987 87 84_88 Merge previous year for 1987 (97085 real changes made) Merging 1987 file using morg86.dta (year<=2000) Dropping non-matches from the matchfile (217592 observations deleted) Dropping the _merge variable Merging 1987 file using morg88.dta (year<2000) Dropping non-matches from the matchfile (204676 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5803 real changes made) (0 real changes made) Eliminating 'matches' with different sex (42 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (784 real changes made) (784 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match87 | 337632 .6834571 .4651281 0 1 match2 | 337632 .6831373 .4652541 0 1 . matchid 1988 88 84_88 Merge previous year for 1988 (88133 real changes made) Merging 1988 file using morg87.dta (year<=2000) Dropping non-matches from the matchfile (220976 observations deleted) Dropping the _merge variable Merging 1988 file using morg89.dta (year<2000) Dropping non-matches from the matchfile (214132 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (6040 real changes made) (0 real changes made) Eliminating 'matches' with different sex (21 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (484 real changes made) (484 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match88 | 321189 .6875702 .4634847 0 1 match2 | 321189 .687262 .4636093 0 1 . matchid 1989 89 89_93 Merge previous year for 1989 (89825 real changes made) Merging 1989 file using morg88.dta (year<=2000) Dropping non-matches from the matchfile (210267 observations deleted) Dropping the _merge variable Merging 1989 file using morg90.dta (year<2000) Dropping non-matches from the matchfile (222265 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (6010 real changes made) (0 real changes made) Eliminating 'matches' with different sex (11 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (205 real changes made) (205 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match89 | 324916 .6877316 .4634194 0 1 match2 | 324916 .6877316 .4634194 0 1 . matchid 1990 90 89_93 Merge previous year for 1990 (96159 real changes made) Merging 1990 file using morg89.dta (year<=2000) Dropping non-matches from the matchfile (206019 observations deleted) Dropping the _merge variable Merging 1990 file using morg91.dta (year<2000) Dropping non-matches from the matchfile (214311 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5745 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match90 | 341162 .6931897 .4611706 0 1 match2 | 341162 .6931897 .4611706 0 1 . matchid 1991 91 89_93 Merge previous year for 1991 (89889 real changes made) Merging 1991 file using morg90.dta (year<=2000) Dropping non-matches from the matchfile (217824 observations deleted) Dropping the _merge variable Merging 1991 file using morg92.dta (year<2000) Dropping non-matches from the matchfile (210397 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (6253 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match91 | 337649 .7074566 .4549312 0 1 match2 | 337649 .7074566 .4549312 0 1 . matchid 1992 92 89_93 Merge previous year for 1992 (87449 real changes made) Merging 1992 file using morg91.dta (year<=2000) Dropping non-matches from the matchfile (215862 observations deleted) Dropping the _merge variable Merging 1992 file using morg93.dta (year<2000) Dropping non-matches from the matchfile (207736 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (5641 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match92 | 332184 .7120572 .452805 0 1 match2 | 332184 .7120572 .452805 0 1 . matchid 1993 93 89_93 Merge previous year for 1993 (87931 real changes made) Merging 1993 file using morg92.dta (year<=2000) Dropping non-matches from the matchfile (211796 observations deleted) Dropping the _merge variable Merging 1993 file using morg94.dta (year<2000) Dropping non-matches from the matchfile (202316 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (7845 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (32 real changes made) (32 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match93 | 328124 .6993027 .458562 0 1 match2 | 328124 .6993027 .458562 0 1 . matchid 1994 94 94_97 Merge previous year for 1994 (155824 real changes made) Merging 1994 file using morg93.dta (year<=2000) Dropping non-matches from the matchfile (211177 observations deleted) Dropping the _merge variable Merging 1994 file using morg95.dta (year<2000) hhid was str12 now str15 Dropping non-matches from the matchfile (269814 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3407 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (32 real changes made) (32 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match94 | 319263 .4951498 .4999773 0 1 match2 | 319263 .4950777 .4999766 0 1 . matchid 1995 95 94_97 Merge previous year for 1995 (233969 real changes made) Merging 1995 file using morg94.dta (year<=2000) Dropping non-matches from the matchfile (274684 observations deleted) Dropping the _merge variable Merging 1995 file using morg96.dta (year<2000) Dropping non-matches from the matchfile (243333 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (945 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (9 real changes made) (9 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match95 | 314366 .2485161 .4321532 0 1 match2 | 314366 .2485065 .4321477 0 1 . matchid 1996 96 94_97 Merge previous year for 1996 (135732 real changes made) Merging 1996 file using morg95.dta (year<=2000) Dropping non-matches from the matchfile (279840 observations deleted) Dropping the _merge variable Merging 1996 file using morg97.dta (year<2000) Dropping non-matches from the matchfile (174884 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (2315 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (2 real changes made) (2 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match96 | 277857 .4965864 .4999892 0 1 match2 | 277857 .4965792 .4999892 0 1 . matchid 1997 97 94_97 Merge previous year for 1997 (67598 real changes made) Merging 1997 file using morg96.dta (year<=2000) Dropping non-matches from the matchfile (172085 observations deleted) Dropping the _merge variable Merging 1997 file using morg98.dta (year<2000) Dropping non-matches from the matchfile (174853 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3231 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match97 | 280655 .7414049 .4378634 0 1 match2 | 280655 .7414049 .4378634 0 1 . matchid 1998 98 98 Merge previous year for 1998 (66276 real changes made) Merging 1998 file using morg97.dta (year<=2000) Dropping non-matches from the matchfile (175116 observations deleted) Dropping the _merge variable Merging 1998 file using morg99.dta (year<2000) Dropping non-matches from the matchfile (175969 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3462 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match98 | 280392 .7447609 .4359963 0 1 match2 | 280392 .7447609 .4359963 0 1 . matchid 1999 99 98 Merge previous year for 1999 (66200 real changes made) Merging 1999 file using morg98.dta (year<=2000) Dropping non-matches from the matchfile (173644 observations deleted) Dropping the _merge variable Merging 1999 file using morg00.dta (year>=1999 & year < 2002) Dropping non-matches from the matchfile (175316 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3859 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (0 real changes made) (0 real changes made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match99 | 282717 .7456715 .4354839 0 1 match2 | 282717 .7456644 .4354879 0 1 . matchid 2000 00 98 Merge previous year for 2000 (67651 real changes made) Merging 2000 file using morg99.dta (year<=2000) Dropping non-matches from the matchfile (174794 observations deleted) Dropping the _merge variable Merging 2000 file using morg01.dta (year>=1999 & year < 2002) Dropping non-matches from the matchfile (197148 observations deleted) Dropping the _merge variable Eliminating 'matches' that are too far apart in age (3827 real changes made) (0 real changes made) Eliminating 'matches' with different sex (0 real changes made) (0 real changes made) Eliminating 'matches' with different race (0 real changes made) (0 real changes made) (1 real change made) (1 real change made) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- match00 | 283239 .7413951 .4378688 0 1 match2 | 283239 .7413915 .4378708 0 1 . mmatchid 2000 00 98 unrecognized command: mmatchid r(199); end of do-file r(199);