Hi,
Newbie to Stata and trying two merge two datasets (one from Compustat and one from Execucomp) with unique ID numbers (these are called 'gvkey'). The problem I'm facing arises when I want to merge the two datasets based upon their 'gvkey', I keep getting the message that "gvkey does not uniquely identify observations" (both for master and using data). I get why Stata reports this message, as each 'gvkey' has a observation per year, but I do not know how to go further at this point. My goal is to merge the two datasets based on their 'gvkey' and 'fyear' (see below).
Dataset 1:
GVKEY FYEAR IBC OANCF
001004 1994 $X $X
001004 1995 $X $X
001004 1996 $X $X
Dataset 2:
GVKEY FYEAR CEO EARLYYEARS
001004 1994 1 1
001004 1995 1 1
001004 1996 1 1
----------
What I whish to get is this:
Dataset 1+2 (merged):
GVKEY FYEAR IBC OANCF CEO EARLYYEARS
001004 1994 $X $X 1 1
etc. etc.
----------
Please help me out!
Thanks in advance!!
Related Posts with Merging datasets with multiple observations per company ID
How to reset a loop with a continues set of codes?Hi everyone, I hope you are doing well. I'm posting here because I have a doubt regarding a loop I'…
'SWEXP': piecewise exponential distribution functionI thank Kit for making a command swexp available on SSC. This command calculates quantities from a …
Using value labels in graphs through loopsHi all, I am trying to create a graph of weekly_count_visittype (Y axis) and week_num (X axis) separ…
Calculating 95% CI for a chi square analysis?If I'm looking for how a category "treatment type" affects category "diagnosis" in a 2x2 chi square …
How to use the results of LCA(Latent Class Analysis) in the next step of regression analysis?Hello! I used gsem to perform an LCA analysis and separated the categories. How can I use this cate…
Subscribe to:
Post Comments (Atom)
0 Response to Merging datasets with multiple observations per company ID
Post a Comment