Hi all! I tried everything and searched everything I could, but I can't find the solution to this. I got this data about US Patents and will merge it with another dataset that has also rf_id as a variable. In the end I want to count the number of patents per company (gvkey) and get panel data on how much patents they acquired from other companies and later on merging it with another file using the gvkey (data from 1980-2013). Now ofcoure gvkey's change over the year and the data I have accounts for that with different gvkeys (ee_gvkey1, ee_gvkey2, etc.) and their respective beginning year and end year (ee_begyr1, etc.)(ee_endyr1, etc.). Now I really can't wrap my head around it how I make it possible to get panel data with gvkey's as identifiers with the right gvkey at the right year. At the moment all I can do is use ee_gvkey1 and merge on that, but that would give me ofcourse bad data. Can you give me some tips to get me on the right path? Here is the code (I hope I did it right with dataex like this):
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input long rf_id float(ee_begyr1 ee_endyr1) str6 ee_gvkey1 float(ee_begyr2 ee_endyr2) str6 ee_gvkey2 float(ee_begyr3 ee_endyr3) str6 ee_gvkey3
12788691 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
12884485 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
18407946 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
13230686 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
21679509 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
5191474 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
22960523 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
22960506 1974 1991 "002541" 1993 2005 "014384" 2007 2010 "273499"
9048598 1994 2002 "031530" 2003 2010 "061737" 2011 2014 "270151"
9242737 1994 2002 "031530" 2003 2010 "061737" 2011 2014 "270151"
13086832 1994 2002 "031530" 2003 2010 "061737" 2011 2014 "270151"
11026422 1994 2002 "031530" 2003 2010 "061737" 2011 2014 "270151"
10681648 1994 2002 "031530" 2003 2010 "061737" 2011 2014 "270151"
end
(small disclaimer: There are also companies that just have one gvkey (only ee_gkvey1 for 1980-2012) and companies that have multiple gvkey's at the same time overlapping
)
0 Response to Not understanding how to get my panel data ready
Post a Comment