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: AW: Reshape


From   Elena Quercioli <[email protected]>
To   [email protected]
Subject   Re: st: AW: Reshape
Date   Wed, 15 Sep 2010 11:27:33 +0200

Thank you, Martin, so much for you help on this. I am a new Stata
user. To answer your question about my need for a wide format: I want
to run a regression treating my dataset as a panel. For the egen group
command suggestion you made, can you please clarify. I am a little
confused about the sequence of commands there.  Elena

On Wed, Sep 15, 2010 at 11:15 AM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> BTW, Elena, it is rare for Stata users to -reshape wide-, b/c Stata just
> loves the long format. What is it that you can do with the wide format that
> you cannot do with the long one?
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Elena Quercioli
> Gesendet: Mittwoch, 15. September 2010 10:56
> An: [email protected]
> Betreff: st: Reshape
>
> I have a dataset with multiple identifiers(id2 and id). Here is an
> example of it:
>
> +---------------------------------------------------------------------------
> -
>       |  id   year          x   county        vars   varlabel    id2 |
>
> |---------------------------------------------------------------------------
> |
>    1. |   1   1979       790         1       suic        suic      1 |
>    2. |   1   1980     4.823         1       suic        suic      2 |
>    3. |   1   1981     2.560         1       suic        suic      3 |
>    4. |   1   1982     1.890         1       suic        suic      4 |
>    5. |   1   1983     1.137         1       suic        suic      5 |
>    6. |   1   1984     2.540         1       suic        suic      6 |
>    7. |   1   1985     3.205         1       suic        suic      7 |
>    8. |   1   1986     5.770         1       suic        suic      8 |
>    9. |   1   1987     4.748         1       suic        suic      9 |
>   10. |   1   1988     5.467         1       suic        suic     10 |
>   11. |   1   1989     7.141         1       suic        suic     11 |
>   12. |   1   1990     3.053         1       suic        suic     12 |
>   13. |   1   1991     8.661         1       suic        suic     13 |
>   14. |   1   1992     3.342         1       suic        suic     14 |
>   15. |   1   1993       826         1       suic        suic     15 |
>   16. |   1   1994     3.934         1       suic        suic     16 |
>   17. |   1   1995     4.784         1       suic        suic     17 |
>   18. |   1   1996     7.504         1       suic        suic     18 |
>   19. |   1   1997     2.447         1       suic        suic     19 |
>   20. |   1   1998     4.397         1       suic        suic     20 |
>   21. |   1   1999     4.915         1       suic        suic     21 |
>   22. |   1   2000     6.089         1       suic        suic     22 |
>   23. |   1   2001     6.756         1       suic        suic     23 |
>   24. |   1   2002     5.557         1       suic        suic     24 |
>   25. |   1   2003     6.346         1       suic        suic     25 |
>   26. |   1   2004     2.588         1       suic        suic     26 |
>   27. |   1   2005     7.878         1       suic        suic     27 |
>   28. |   1   2006     4.150         1       suic        suic     28 |
>
> |---------------------------------------------------------------------------
> -|
>   29. |   2   1979       120         1       west        west      1 |
>   30. |   2   1980       120         1       west        west      2 |
>   31. |   2   1981       121         1       west        west      3 |
>   32. |   2   1982       122         1       west        west      4 |
>   33. |   2   1983       121         1       west        west      5 |
>   34. |   2   1984       120         1       west        west      6 |
>   35. |   2   1985       120         1       west        west      7 |
>
>
> I want to reshape the variable x wide. I typed the command
>
> reshape wide x, i(id2) j(varlabel)
>
> but there are 5 distinct values for j = 1,2,3,4,5 associated with each
> value of id2 in my dataset. How do I proceed to have this dataset
> reshaped with x being wide and the j variables unstacked. My final
> dataset should look like this
>
> ID | Year| Suic|West|Central|Pop!Mount|
> 1    1979  ....     ...      ...        ...    ...
>
>
> .      .
> .      .
> .      .
> 1   2006
>
> 2  1979
> .
> .
> .
> 2  2006
>
> ...   ...      ....     ....      ...      ...    ...
>
> 28 1979 Suic| West|Central|Pop|Mount
>
> Thank you for all the help you can give me on this. Elena
> *
> *   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/
>

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