I'm having trouble with reshaping my data. The data has a (self-explanatory) variable year, a string variable "acquirer", and variables c_* that record the industry in which the acquirer bought a company.
My data currently looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year str9 acquirer double(c_3dprinting c_3dtechnology c_advertising) 2007 "MICROSOFT" 0 0 4 2008 "MICROSOFT" 0 0 3 2014 "ALPHABET" 0 0 3 2007 "ALPHABET" 0 0 2 2014 "FACEBOOK" 0 1 1 end
Code:
* Hand written example of desired data. clear input int year str9 industry double(c_ALPHABET c_MICROSOFT c_FACEBOOK) 2007 "3dprinting" 0 0 0 2008 "3dprinting" 0 0 0 2014 "3dprinting" 0 0 0 2007 "3dtechnology" 0 0 0 2008 "3dtechnology" 0 0 0 2014 "3dtechnology" 0 0 1 2007 "advertising" 2 4 0 2008 "advertising" 0 3 0 2014 "advertising" 3 0 1 end
Edit: I tried to use
Code:
reshape
Code:
xpose
Kind regards and thank you,
Ulrich
0 Response to Help with reshaping data
Post a Comment