Going from long data like
id p obs
1 10 1
1 5 2
1 6 3
2 3 1
2 1 2
2 5 3
to wide data like:
id p1 p2 p3
1 10 5 6
2 3 1 5
requires the -reshape- command, which has changed many times over the
different versions of Stata--in fact, I believe both Stata 6 and Stata
7 implemented changes during their intervals as the most current
versions.
I certainly remember one of them causing trouble for me running an old
do-file under version control with old reshape command syntax that was
good in an earlier version of that release number (I think it was 6)
but not in the last version.
The short answer would be, look at the help file on your system to
determine the -reshape- syntax that applies to you. Or
. version 5
. reshape groups obs
. reshape vars p
. reshape cons id
. reshape long
should work for you, assuming you've got the obs variable defined. If
not, -sort- your data the way you want before you run the above, and
. qui by id: gen long obs=_n
Perhaps Nick Cox has several versions of Stata 6 installed, and is in
a better position to answer this question...
On 9/2/05, <[email protected]> wrote:
> Stata commands tend (always?) to be lowercase. Try
> reshape wide x i(id) j(rate)
> And I'm not sure about v.6, but you may have to include a comma after
> wide, e.g.
> reshape wide, i(id) j(rate)
> Good luck,
> Clint
>
> > Hello, I tried Stephen Bradleys command, to transpose data but got this
> > error.
> >
> > Reshape wide x i(id) j(rate)
> > reshape already defined
> > (error occurred while loading Reshape.ado)
> > r(110);
> >
> > Can someone explain? I am a new user and using version 6
> > Thanks
> > Jeff
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/