* IndMatch.sas; * Program to match data on individuals from year to year; * using variables x7 Random Cluster, x10 Family Serial Number,; * x33 Age, x72 Race and x76 Sex; * May 28, 1996; options nocenter ps=79; libname save '.'; data Indiv1 (Rename=(x3=y13 x14=y114 x15=y115 x32=y132 x33=y133 x34=y134 x35=y135 x36=y136 x37=y137 x38=y138 x39=y139 x40=y140 x41=y141 x44=y144 x45=y145 x46=y146 x47=y147 x48=y148 x49=y149 x50=y150 x51=y151 x52=y152 x53=y153 x54=y154 x55=y155 x56=y156 x57=y157 x58=y158 x59=y159 x60=y160 x61=y161 x63=y163 x64=y164 x65=y165 x66=y166 x67=y167 x68=y168 x69=y169 x70=y170 x71=y171 x72=y172 x73=y173 x74=y174 x75=y175 x76=y176 x78=y178 x79=y179 x80=y180 x81=y181 x83=y183 x84=y184 x85=y185 x86=y186 x88=y188 x89=y189 x90=y190 x94=y194 x95=y195 x96=y196 x98=y198 x99=y199 x107=y1107 x108=y1108 x114=y1114 x115=y1115 x116=y1116 x117=y1117)); set save.Year1; gender=x76; race=x72; mage1=x33; output; mage1=x33+1; output; mage1=x33+2; output; run; proc sort; by x7 x10 mage1 race gender; run; data Indiv2 (Rename=(x3=y23 x14=y214 x15=y215 x32=y232 x33=y233 x34=y234 x35=y235 x36=y236 x37=y237 x38=y238 x39=y239 x40=y240 x41=y241 x44=y244 x45=y245 x46=y246 x47=y247 x48=y248 x49=y249 x50=y250 x51=y251 x52=y252 x53=y253 x54=y254 x55=y255 x56=y256 x57=y257 x58=y258 x59=y259 x60=y260 x61=y261 x63=y263 x64=y264 x65=y265 x66=y266 x67=y267 x68=y268 x69=y269 x70=y270 x71=y271 x72=y272 x73=y273 x74=y274 x75=y275 x76=y276 x78=y278 x79=y279 x80=y280 x81=y281 x83=y283 x84=y284 x85=y285 x86=y286 x88=y288 x89=y289 x90=y290 x94=y294 x95=y295 x96=y296 x98=y298 x99=y299 x107=y2107 x108=y2108 x114=y2114 x115=y2115 x116=y2116 x117=y2117)); set save.Year2; gender=x76; race=x72; mage1=x33; output; run; proc sort; by x7 x10 mage1 race gender; run; data Indiv; merge Indiv1 Indiv2; by x7 x10 mage1 race gender; run; data person; set Indiv; if y233 ne . then output person; run; data Match; set person; if y133 eq y233 then year=-1; else if y233 eq y133+1 then year=0; else if y233 eq y133+2 then year=1; if y139 eq y239 then occ=0; else if y139 ne . then occ=1; if y138 eq y238 then ind=0; else if y138 ne . then ind=1; if y179 eq y279 then vet=0; else if y179 ne . then vet=1; if y149 eq y249 then grade=0; else if y249 eq y149+1 then grade=-1; else if y149 ne . then grade=1; run; proc freq; table year /missing; label -1='ageyr1=ageyr2' 0='ageyr1+1=ageyr2' 1='ageyr1+2=ageyr2' .='missing'; table occ /missing; label 0='occyr1=occyr2' 1='occyr1 ne occyr2' .='missing'; table ind /missing; label 0='indyr1=indyr2' 1='indyr1 ne indyr2' .='missing'; table vet /missing; label 0='vetstatyr1=vetstatyr2' 1='vetstatyr1 ne vetstatyr2' .='missing'; table grade /missing; label 0='gradeyr1=gradeyr2' 1='gradeyr1 ne gradeyr2' .='missing'; tables year*occ /missing; tables year*ind /missing; tables year*occ*ind /missing; tables year*vet /missing; tables year*grade /missing; run;