Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: How to transfer strings in different rows of a cell into different observations


From   XIAOFEI XING <mike.xf.xing@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: How to transfer strings in different rows of a cell into different observations
Date   Sat, 22 Jun 2013 17:03:31 +0100

Dear Statalist,

I have a following format excel file:

Number        ID                Assignment
1                   A A                  AS1 E2
                       B                    AS2 A3
                       C                   AS3
2                    A                    AS6
                     D F                  AS2
                       F                   AS10
3                  W W                AS9

Take the observation Number 1 as an example, string "A A", "B" and "C" are in the different rows of a same cell of a excel file. Similarly, string "AS1 E2", "AS2 A3" and "AS3" are also in the same cell.

I want to use Stata to transfer different rows of strings into different observations, showing as following:

Number        ID                Assignment
1                   A A                  AS1 E2
1                     B                   AS2 A3
1                     C                    AS3
2                     A                    AS6
2                   D F                  AS2
2                     F                    AS10
3                  W W                 AS9

How can I do it?

Thanks a lot!

Xiaofei Xing
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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