Dear All
I have datasets that look like:
Call this:
ibes.dta
Another data set, call it:
finance
The trusted link between the data can be obtained by CUSIP and yr . However, after I merge the data, I will end up with some observations that are not merged because they do not have available cusip in both data sets. For these observations, I want to do another trial using TICKER yr.
I did the following:
use finance.dta,clear
duplicates drop cusip yr
sort cusip yr
save new_finance,replace
use ibes.dta
duplicates drop cusip yr,force
sort cusip yr
compress
save new_ibes,replace
merge 1:1 cusip yr using new_finance.dta
Output:
Result # of obs.
-----------------------------------------
not matched 104,145
from master 83,118 (_merge==1)
from using 21,027 (_merge==2)
matched 51,420 (_merge==3)
***********Now how can I try with a second merge using TICKER yr ??
Thanks
I have datasets that look like:
Call this:
ibes.dta
CUSIP | TICKER | yr | eps |
. | ASTT | 1980 | 0.2 |
. | ASTT | 1981 | 0.3 |
00000011 | AGO | 1980 | 0.4 |
00000011 | AGO | 1981 | 0.2 |
30405567 | PPT | 2000 | 0.4 |
30406678 | FFB | 1980 | 1.4 |
73636392 | KNN | 1980 | 1.1 |
.... | KNN | 1981 | 2.1 |
45999332 | . | 1980 | 0.81 |
finance
CUSIP | TICKER | yr | cashflow |
ASTT | 1980 | 1000000 | |
ASTT | 1981 | 8000000 | |
00000011 | AGO | 1980 | 9000000 |
45999332 | 8333387 |
I did the following:
use finance.dta,clear
duplicates drop cusip yr
sort cusip yr
save new_finance,replace
use ibes.dta
duplicates drop cusip yr,force
sort cusip yr
compress
save new_ibes,replace
merge 1:1 cusip yr using new_finance.dta
Output:
Result # of obs.
-----------------------------------------
not matched 104,145
from master 83,118 (_merge==1)
from using 21,027 (_merge==2)
matched 51,420 (_merge==3)
***********Now how can I try with a second merge using TICKER yr ??
Thanks
Comment