Hi Statalist,

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
For example, in the first line of the data, Microsoft bought 4 companies in the advertising industry in 2007. What I would like to have is a panel data set following the industries (3dprinting 3dtechnology advertising) over time. Maybe best described as xtset industry year. The desired data looks like the following:


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
I would appreciate help on how to get from the first data structure to the second.

Edit: I tried to use
Code:
reshape
and
Code:
xpose
both without much success. I've googled and solicited the Stata manuals, but couldn't find any solution for this issue. Apologies if this is something trivial.

Kind regards and thank you,
Ulrich