set more 1 capture log close set tr off if "`1'"=="debug" { mac def debug * set tr on mac def runcmnd do log using debug,replace } else { mac def debug mac def runcmnd run } capture prog drop cpslink prog def cpslink drop _all getspace 90000 90 local i 1 $runcmnd macclear.cps $runcmnd getyrmo.cps $runcmnd setmacs $runcmnd testmacs.cps if $macerror { capture log close exit 1 } while `i'<=$Nmatches { mac def yr1=${yr1`i'} mac def yr2=$yr1 + 1 mac def match=$yr1$yr2 ${debug}log on di di di di noisily di " Match $match" ${debug}log off mac def j=1 while $j<=4 { mac def mo$j=${mo$j`i'} if ${mo$j}>=1 & ${mo$j}<=4 { char ${mo$j} mac def mo$j=${mo$j`i'} noisily display noisily display "MIS $j suffix-$char" if $unix & $bloat { !zcat $datain$match$char.dta.Z > ${temploc}junk.dta use ${temploc}junk,clear } else { use $datain$match$char,clear } replace mis=mis-4 if year==%yr2 $runcmnd addvars gen long match_id=. gen byte level=0 mac def leftoff 0 save ${temploc}junk,replace $runcmnd first.cps mac def step 1 while $step<=$steps { $runcmnd match.cps ${match$step} $runcmnd resdups.cps ${break$step} mac def step=$step + 1 } /*closes step*/ $runcmnd last.cps $char } /* closes if ${mo$j} */ else if ${mo$j}~=. { ${debug}log on noisily display "${mo$j} in line `i' of yearlist.raw invalid." ${debug}log off } /*closes else regarding ${mo$j} */ mac def j=$j+1 } /* closes j */ local i=`i' + 1 } /* closes i */ $runcmnd cleanup.cps end cpslink exit 0