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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Rehape help


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Rehape help
Date   Mon, 6 Feb 2012 11:44:16 +0000

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/


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