Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Reshape help


From   Tim Evans <Tim.Evans@wmciu.nhs.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Reshape help
Date   Mon, 6 Feb 2012 12:31:42 +0000

Nick, Phil,

Thanks for your replies, that's worked a trick. I had too much incorrect code to show, but I agree it would have been helpful.

Best wishes

Tim

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 06 February 2012 11:44
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Rehape help

We can't say where you are going wrong if you don't show us any code,
but consider

reshape wide Var1, i(Lab) j(startyear)

Nick

On Mon, Feb 6, 2012 at 11:21 AM, Tim Evans <Tim.Evans@wmciu.nhs.uk> wrote:

> I'm using Stata 11.2 and want to use reshape to change the layout of my data and I'm struggling a bit. My current data look like this:
>
> Var1       startyear              Lab
> 0.6692   1986                       1 1
> 0.7734   1986                       2 1
> 0.5548   1986                       3 1
> 0.6590   1987                       1 1
> 0.7526   1987                       2 1
> 0.5972   1987                       3 1
>
> What I want to have is
>
> Lab         Var1Startyear1986           Var1Startyear1987
> 1 1          0.6692                                   0.6590
> 2 1          0.7734                                   0.7526
> 3 1          0.5548                                   0.5972
>
> I've tried reshape with a variety of different syntax, but cant seem to reproduce how I want the data.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index