Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72795

Stacking 5 columns under 5 other columns, 200 times

$
0
0
I have a dataset with the following structure:
year Company 1 data A Company 1 data B Company 1 data C Company 2 data A Company 2 data B Company 2 data C Company 3 data A Company 3 data B ...
1
2
3
...
I have around 1,000 different companies, each with 5 data points (3 in this simplified example).
I would like to make this a panel structure, as follows:
year company Data A Data B Data C
1 1
2 1
3 1
1 2
2 2
3 2
1 3
...
I am aware of the reshape command. However, I do not see how I can use it in this context - if it is usable after all. In essence, I feel like I would neet to 'cut' the observations of each company and 'paste' them under those of the first, while creating a new variable that indicates which company is inserted, and repeating the 'year' values.

Many thanks for any potential help.

Viewing all articles
Browse latest Browse all 72795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>