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

From |
Pancho Villa <panchovillainnyc@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Reshape like problem |

Date |
Thu, 4 Jun 2009 15:28:33 -0400 |

Thank you so much! On Thu, Jun 4, 2009 at 2:25 PM, Austin Nichols <austinnichols@gmail.com> wrote: > 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/ > * * 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/

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

**Re: st: Reshape like problem***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**st: suggestions on a model** - Next by Date:
**Re: st: suggestions on a model** - Previous by thread:
**Re: st: Reshape like problem** - Next by thread:
**RE: st: Reshape like problem** - Index(es):

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