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: reshape data


From   R Zhang <[email protected]>
To   [email protected]
Subject   st: reshape data
Date   Sun, 16 Feb 2014 21:45:17 -0500

Dear All,
I want to do a merge , the dataset ONE is the using data set.

dataset ONE has the following structure:

EntityID 100091
corpid1 8101
begyr1 1961
gvkey1 1000
endyr1 1970
corpid2 8091
begyr2 1971
gvkey2 1000
endyr2 1973
corpid3 8011
begyr3 1974
gvkey3 1001
endyr3 2000

entityID is a unique company id.Over time, the company may reorganize
due to merge & acquisition, that is why you see corpid1,2,3 and
gvkey1,2,3 with the beginning and ending years,that is,

from 1961, to 1970, crpid1 8101 and gvkey1 1000 are effective.

from 1971, to 1973, crpid2 8091 and gvkey2 1000 are effective.

I would like to reshape the data into:

EntityID corpid beginyr  gvkey   endyr
100091   8101 1961   1000          1970
100091   8091  1971    1000     1973
100091   8011  1974    1001     2000

could you help?

thanks a bunch,

-R
*
*   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