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   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   Re: st: How to transfer strings in different rows of a cell into different observations
Date   Sun, 23 Jun 2013 21:43:38 +0900

XIAOFEI XING wrote:

. . . My question is about how to split one cell into different observations.

I import data from excel, if a cell contain following content, 
A A
B
C
Stata will treat the cell into one observations rather than three observations

I want to use state to transfer them into different observations.

--------------------------------------------------------------------------------

Your Excel worksheet appears to have carriage returns or line feeds, or their
combination, inside the cell.  Try using -split-, parsing on one or the other
character (or their combination) and then -reshape-.

I recall that there's a user-written command that reveals the ASCII characters
inside an observation.  I've forgotten what its name is, but you can use
-indexnot()-or -strpos()- with -char(10)- and -char(13)- to accomplish the same
thing.

Joseph Coveney


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