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: How to transfer strings in different rows of a cell into different observations


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: How to transfer strings in different rows of a cell into different observations
Date   Sat, 22 Jun 2013 17:09:04 +0100

This is an FAQ. Standard Statalist advice is to look at the FAQs before posting.

http://www.stata.com/support/faqs/data-management/replacing-missing-values/

explains that

replace number = number[_n-1] if missing(number)

is a way to do this.

Nick
[email protected]

On 22 June 2013 17:03, XIAOFEI XING <[email protected]> wrote:

> 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
>
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index