Statalist


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

Re: st: RE: data reorganization


From   Arina Viseth <arina@UDel.Edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: data reorganization
Date   Sat, 7 Feb 2009 19:11:44 -0500 (EST)

Thank you very much!

Arina

---- Original message ----
>Date: Sat, 7 Feb 2009 18:44:26 -0500
>From: owner-statalist@hsphsun2.harvard.edu (on behalf of "Steichen, Thomas J." <SteichT@RJRT.com>)
>Subject: st: RE: data reorganization   
>To: "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
>
>I can't imagine a reason for wanting this but the following code will do so (but in new variables).
>
>levelsof indice, l(i)
>qui gen newindice = .
>qui gen newyear = ""
>local j = 1
>foreach index of local i {
>  levelsof year if indice == `index', l(yrs) s(", ")
>  qui replace newindice = `index' in `j'
>  qui replace newyear = "`yrs'" in `j'
>  local j = `j' + 1
>}
>
>-----------------------------------
>Thomas J. Steichen
>steicht@rjrt.com
>-----------------------------------
>
>-----Original Message-----
>From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Arina Viseth
>Sent: Saturday, February 07, 2009 6:08 PM
>To: statalist@hsphsun2.harvard.edu
>Subject: st: data reorganization
>
>Dear all,
>
>I have a question regarding how to re-organize my data on stata.
>
>Here is how the data currently looks:
>
>Indice Year
>1      1990
>1      1991
>2      2000
>2      2001
>2      2003
>3      1995
>3      1996
>4      2002
>
>Would it be possible to re-arrange the data so that I would have the following:
>
>Indice  Year
>1       1990, 1991
>2       2000, 2001, 2003
>3       1995, 1996
>4       2002
>
>
>Any suggestion would be very much appreciated. Thank you in advance.
>
>Arina
>
>*
>*   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/
>
>CONFIDENTIALITY  NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information. If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.
>
>*
>*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index