Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Merge two datasets – restructure the using dataset


From   R Zhang <[email protected]>
To   [email protected]
Subject   st: Merge two datasets – restructure the using dataset
Date   Mon, 17 Feb 2014 15:06:01 -0500

Dear All,

I want to do a merge , the using dataset USE (call it U) has the
following structure:

EntityID            corpid1 begyr1  gvkey1 endyr1  corpid2 begyr2
gvkey2 endyr2  corpid3 begyr3  gvkey3 endyr3

100091  8101     1961     1000     1970     8091     1971     1000
1973     8011     1974     1001     2000

The master dataset (call it M):

EntityID  var1 var2 ….

100091    x     y

100090    a    b

The master data has EntityID that will be used in the merge. This
merge will link entity ID to gvkey for each period.

The next step is to link the merged data to another data set that has
gvkey, year , and firm financial data.

Should I change the data structure of U into something like

EntityID            corpid   year      gvkey

100091  8101     1961     1000

100091  8101     1962     1000

100091  8101     1963     1000

100091  8101     1964     1000

100091  8101     1965     1000

100091  8101     1966     1000

100091  8101     1967     1000

100091  8101     1968     1000

100091  8101     1969     1000

Would reshape do this?



Thanks !!!

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index