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 at the end of May, and its replacement, statalist.org is already up and running.


[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 <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: How to transfer strings in different rows of a cell into different observations
Date   Sun, 23 Jun 2013 14:28:39 +0100

The user-written command Joseph is recalling may be -charlist- (SSC).
Nick
njcoxstata@gmail.com


On 23 June 2013 13:43, Joseph Coveney <stajc2@gmail.com> wrote:
> 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/
*
*   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