Dear Stata experts,
I have a problem when creating a panel. I have such a structure:
I would like to reshape data into the long format so that I would have:
I tried a code:
I got an error. The other issue is that I have few time AustraliaAustria and AustraliaCanada since there are different numbers after it, e.g. AustraliaAustria01 AustraliaAustria02 etc.
Here is sample of my data:
I have a problem when creating a panel. I have such a structure:
| period | AustraliaAustria01 | ... | AustraliaCanada99 |
| 1990 | 3.5 | .... | 2.7 |
| .... | .... | ..... | .... |
| 2018 | 3.7 | ..... | 2.9 |
| period | exporter | importer | ISIC | export |
| 1990 | Australia | Austria | 01 | 3.5 |
| ... | ..... | ..... | .... | .... |
| 2018 | Australia | Canada | 99 | 2.9 |
I tried a code:
Code:
reshape long AustraliaAustria-AustraliaCanada,i(period) j(ISIC)
Here is sample of my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(AustraliaAustria01 AustraliaAustria011 AustraliaAustria0111) 3.09566901071224 .57895066182819 .294643535250431 4.5952602023237 2.25751780793534 2.11941353857843 5.2282254216153 3.62389907526694 3.2407176217882 3.60528197241182 2.27059248575925 2.15936564523635 4.20129878529848 2.61912210318222 2.48602899558369 1.66267308728776 .718284669540413 .601226761357698 1.67174006197263 .782547191550645 .713766766181845 1.46324874669685 1.14965136733421 1.02237855424437 1.49118616589432 1.33347393623139 1.17672043293244 .797078970751392 .71046188236338 .620047433227721 .685350935246251 .614281599995358 .548381828240676 .790855012105365 .575420760492461 .517316716681913 .678040814956461 .572556585585948 .481116637902978 .962200827340452 .648574348691287 .387374677722107 .539462037877982 .46406333019581 .289660600577625 .829157935583996 .501237842646939 .0739293580848232 .892993578681696 .297647331955208 .0716496026031399 1.1831879757206 .330713317689642 .0790955954086102 .722686752070487 .254740682283988 .0355505518170268 1.25267905943902 .785066710532028 .0507452481777911 end

Comment