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 do I split my string variable by capital letters?


From   Anna Reimondos <[email protected]>
To   [email protected]
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 <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index