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

RESHAPE in STATA

$
0
0
Hi Statalist!


My data is presented like this:
COUNTRY PARTNER YR2001 YR2002 YR2003
A...................... B ...........1............... 2.............3
B ......................A........... 4............... 5.............6

and I would like to obtain this:
COUNTRY PARTNER YEAR TRADE
A...................... B ..........2001.........1
B ......................A...........2001.........4
A.......................B...........2002.........2

I am trying the command: reshape long YR, i(COUNTRY) j(YEAR)
and reshape long YR, i(COUNTRY PARTNER) j(YEAR)
but they say the following error:
variable id does not uniquely identify the observations
Your data are currently wide. You are performing a reshape long. You specified
i(COUNTRY PARTNER) and j(year). In the current wide form, variable COUNTRY should
uniquely identify the observations. Remember this picture:


Which command should I use to obtain this result?

Thank you very much!

Best,

JD

Viewing all articles
Browse latest Browse all 73303

Trending Articles



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