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


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: reshape
Date   Mon, 4 Jun 2012 06:00:07 -0500

reshape long povcl1_def povcl2_def povcl3_def, i(region)
rename *def rate#, addnumber
reshape long rate, i(region _j) j(povcl)
rename _j def


Scott


On Mon, Jun 4, 2012 at 5:51 AM, Nick Cox <[email protected]> wrote:
> You don't show your code so I can't comment on what you are doing
> wrong. At a wild guess you are trying to do this with one -reshape-,
> but I see it as a long - long reshape, so you need two.
>
> See the appropriate sections in
>
> 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
>
> Code something like this. (If you have Stata 12 or have installed
> -renvars- (SJ), the initial renaming can be simpler.)
>
> foreach v of var pov* {
>        local newname : subinstr local v "_def" ""
>        rename `v' `newname'
> }
>
> reshape long povcl1 povcl2 povcl3 , i(region) j(def)
>
> reshape long povcl , i(region def)
> rename povcl rate
> rename _j povcl
>

*
*   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