Friday, October 21, 2005

Super Cool Matching Code By Franco, Cassar, and Center-Zechman

Here’s a matching program where I matched on industry (the barth, beaver, landsman 15 industry codes), the existence of disclosure variables, the period in time as I had floating windows and all firm within the upper and lower bounds. After running this program, you just need to determine which of the firms meeting the criteria to keep as there are likely several firms for each sample firm within the upper and lower bounds. What I did was to calculate |diff|=sample(nidiff_assets)- match(nidiff_assets) and keep the absolute closest making sure not to keep duplicate matches.



Props to Aunt Fran for the underlying code!
...and Gavin for the 0.01 innovation.



%LET max = 1.50;

%LET min = 0.50;



*set the upper bound as the greater of variable*max(above) and variable+0.01;

max1=&max*nidiff_assets;

max2=nidiff_assets+0.01;

if nidiff_assets=. then max=.;

else if max1>max2 then max=max1;

else if max2>=max1 then max=max2;

else max=.;



*set the lower bound as the lesser of variable*min(above) and variable-0.01;

min1=&min*nidiff_assets;

min2=nidiff_assets-0.01;

if nidiff_assets=. then min=.;

else if min1
else if min2<=min1 then min=min2;

else min=.;



DATA temp; SET temp;

RENAME nidiff_assets=nidiffasset_sample;



PROC SQL;

CREATE TABLE temp1 AS SELECT

temp.*, match_comp_ind.gvkey, match_comp_ind.industry, match_comp_ind.pre_beg, match_comp_ind.flg_file,

match_comp_ind.flg_call, match_comp_ind.flg_ratio, match_comp_ind.nidiff_assets, match_comp_ind.assets,

match_comp_ind.sum_diff, match_comp_ind.filings_diff, match_comp_ind.calls_diff, match_comp_ind.sic,

match_comp_ind.rev_ratio_diff

FROM temp, mydata.match_comp_ind

WHERE temp.pre_beg_sample=match_comp_ind.pre_beg AND

temp.industry_sample=match_comp_ind.industry AND

temp.flg_file_sample=match_comp_ind.flg_file AND

temp.flg_call_sample=match_comp_ind.flg_call AND

temp.flg_ratio_sample=match_comp_ind.flg_ratio AND

temp.min <= match_comp_ind.nidiff_assets <= temp.max;

QUIT;

0 Comments:

Post a Comment

<< Home