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]

Re: st: How do I split my string variable by capital letters?


From   Anna Reimondos <areimondos@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How do I split my string variable by capital letters?
Date   Thu, 24 Nov 2011 13:10:55 +1100

Hi Elena,
What about if you reshape the data to long format after splitting the
string. That way each entry would appear on its own line?

Anna

On Thu, Nov 24, 2011 at 10:22 AM, Elena Vidal <maria.vidal@duke.edu> wrote:
>
> Hi,
>
> I'm having a bit of a problem splitting a string variable.
>
> An example of the variable reads:
> var12
> "Startup/Seed
> Early Stage
> Expansion
> Expansion
> Expansion"
>
> This corresponds to a single cell. That means: all 5 lines appear in 1 cell in my data, and I want to split it up so that each line is a different variable.
>
> I've tried splitting it with this code:
>
> split var12, gen(var12b)
>
> but that didn't work.
>
> I'd appreciate the help trying to sort this out!
> Elena
>
>
>
> *
> *   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   |   Site index