Hi

I have two datasets, one is compustat data and the other is covenant violations (from Creditor Control Rights, Corporate Governance, and Firm Value by Nini et al 2012).

I'm able to merge (code below) but the datadate and gvkey variables don't match correctly (_merge==3 has zero matched).

Code:
merge 1:1 gvkey datadate using compustat.dta
*I also used with m:1
I realized that although I converted/encode/decode my datadate and gvkey variables to be the same, there still seems to be something off.


Code:
 
input str6 gvkey (%6s) input str6 gvkey (%6s)
"1004" "001004"
"1004" "001004"
"1004" "001004"
&
  
input long datadate (%d) input long datadate (%d)
"02281997" "28feb1997"
"02281997" "28feb1997"
"02281997" "28feb1997"
Perhaps it was the way I converted the dates/gvkeys?

The original formats were:

Code:
 
variable label type format
gvkey gvkey str6 %6s
datadate data date long %d
&
  
variable label type format
gvkey identifier double %9.0g
datadate data date str8 %8s
Is there a proper way to make the gvkey and datadate variables be able to merge correctly?

Thanks,
Jeff