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

From |
Austin Nichols <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Reshape like problem |

Date |
Thu, 4 Jun 2009 14:25:30 -0400 |

Pancho Villa <panchovillainnyc@gmail.com> : clear input id value 1 15 2 14 3 22 4 31 5 12 6 10 end g id_1=(id-mod(id-1,3)-1)/3+1 g id_2=mod(id-1,3)+1 l On Thu, Jun 4, 2009 at 2:15 PM, Pancho Villa <panchovillainnyc@gmail.com> wrote: > Dear list, > > I have my data in this kind of form: > > id value > 1 15 > 2 14 > 3 22 > 4 31 > 5 12 > 6 10 > > id_1 id_2 value > 1 1 15 > 1 2 14 > 1 3 22 > 2 1 31 > 2 2 12 > 2 3 10 > > In other words, my data is stacked and would like to un-stack it. (I > can do reshape, I think. But this seems like a necessary first step.) > > Now, in my example, my id goes from 1 to 6, while I'd like id_1 to go > from 1 to 2 and id_2 from 1 to 3. In reality, my id goes from 1 to > 5084280, while I want id_1 to go from 1 to 2088 and id_2 from 1 to > 2435. (If you check, 2088 x 2435 = 5084280.) > > I'll really appreciate if you can share code addressing a very similar > problem so I can just paste it in my do file and tweak a few things. > * * 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/

**Follow-Ups**:**RE: st: Reshape like problem***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: Reshape like problem***From:*Pancho Villa <panchovillainnyc@gmail.com>

**References**:**st: Reshape like problem***From:*Pancho Villa <panchovillainnyc@gmail.com>

- Prev by Date:
**st: Reshape like problem** - Next by Date:
**st: Help with Stata error code r(900);** - Previous by thread:
**st: Reshape like problem** - Next by thread:
**Re: st: Reshape like problem** - Index(es):

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