Hi,
I'm currently writing my thesis and I'm new to Stata. I want to combine a dataset from Compustat and a dataset from Factset, both in yearly terms. I have the following datasets:
Compustat
FactSet
I would like to match both the isin and the year, so I get the lv change of each company for each year.
To merge the, I tried the code "merge m:m isin year using fact, , keepusing(lvchange), but it gave me the error
"variables isin year do not uniquely identify observations in the master data".
Any help on how to fix this would be appreciated.
Thanks
I'm currently writing my thesis and I'm new to Stata. I want to combine a dataset from Compustat and a dataset from Factset, both in yearly terms. I have the following datasets:
Compustat
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long gvkey str12 isin str10 datadate int year float lvchange 1166 "NL0000334118" "31/12/2002" 2002 .006297663 1166 "NL0000334118" "31/12/2003" 2003 .105081 1166 "NL0000334118" "31/12/2004" 2004 .02746665 1166 "NL0000334118" "31/12/2005" 2005 -.01903224 1166 "NL0000334118" "31/12/2006" 2006 -.02919521 1166 "NL0000334118" "31/12/2007" 2007 -.05277575 1166 "NL0000334118" "31/12/2008" 2008 -.05401874 1166 "NL0000334118" "31/12/2009" 2009 .123919 1166 "NL0000334118" "31/12/2010" 2010 -.07997546 1166 "NL0000334118" "31/12/2011" 2011 -.072212696 1166 "NL0000334118" "31/12/2012" 2012 -.09492537 1166 "NL0000334118" "31/12/2013" 2013 -.23273465 1166 "NL0000334118" "31/12/2014" 2014 .007800169 1166 "NL0000334118" "31/12/2015" 2015 -.013378848 1166 "NL0000334118" "31/12/2016" 2016 .000170374 1932 "GB0002875804" "31/12/1995" 1995 . 1932 "GB0002875804" "31/12/1996" 1996 .007074844 1932 "GB0002875804" "31/12/1997" 1997 .02022037 1932 "GB0002875804" "31/12/1998" 1998 .07025388 1932 "GB0002875804" "31/12/1999" 1999 -.27306455 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str12 isin str61 name str12 ri int year byte month "AT0000730007" "ANDRITZ AG" "11.403597" 2002 12 "AT0000730007" "ANDRITZ AG" "72.014046" 2003 12 "AT0000730007" "ANDRITZ AG" "51.732697" 2004 12 "AT0000730007" "ANDRITZ AG" "68.74873" 2005 12 "AT0000730007" "ANDRITZ AG" "79.90005" 2006 12 "AT0000730007" "ANDRITZ AG" "2.558291" 2007 12 "AT0000730007" "ANDRITZ AG" "-54.92813" 2008 12 "AT0000730007" "ANDRITZ AG" "133.72536" 2009 12 "AT0000730007" "ANDRITZ AG" "73.54651" 2010 12 "AT0000730007" "ANDRITZ AG" "-4.4100466" 2011 12 "AT0000730007" "ANDRITZ AG" "56.09789" 2012 12 "AT0000730007" "ANDRITZ AG" "-3.874004" 2013 12 "AT0000730007" "ANDRITZ AG" "1.3872743" 2014 12 "AT0000730007" "ANDRITZ AG" "0.37008524" 2015 12 "AT0000730007" "ANDRITZ AG" "8.931768" 2016 12 "AT0000743059" "OMV AG" "3.7600994" 2002 12 "AT0000743059" "OMV AG" "30.54434" 2003 12 "AT0000743059" "OMV AG" "92.7689" 2004 12 "AT0000743059" "OMV AG" "127.135254" 2005 12 "AT0000743059" "OMV AG" "-11.443013" 2006 12 end
To merge the, I tried the code "merge m:m isin year using fact, , keepusing(lvchange), but it gave me the error
"variables isin year do not uniquely identify observations in the master data".
Any help on how to fix this would be appreciated.
Thanks

Comment