Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Reshape data from wide to long format


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Reshape data from wide to long format
Date   Mon, 24 Sep 2012 13:07:54 +0100

You don't show what you are trying, so that we can explain what you
are getting wrong.

At a guess, you need

reshape long month, i(species country year)
rename month incidence
rename _j month

What is crucial in such problems is (usually) seeing that the
identifier consists of several variables acting jointly.

See also

FAQ     . . . . . . . . . . . . . . . . . . . . . . . .  Problems with reshape
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        12/03   I am having problems with the reshape command. Can
                you give further guidance?
                http://www.stata.com/support/faqs/data/reshape3.html

On Mon, Sep 24, 2012 at 12:56 PM, Shittu, Aminu <[email protected]> wrote:

> I am trying some examples from online help but all in vain. My wide dataset looks like this one
>
> Species  Country  Year  month1  month2  month3  month4  month5  month6  month7  month8  month9  month10  month11  month12
>
> I am interested in converting it to a long format like this
>
> Species  Country  Year  month incidence
>
> Please note that the record for each month is a disease incidence.
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index