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: Splitting string by parse option


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Splitting string by parse option
Date   Wed, 5 Mar 2014 09:23:32 +0000

Works for me

. gen test  = "frogXOOD_toadXOOD_newt"

. split test, parse(XOOD_)
variables created as string:
test1  test2  test3

. l test* in 1

     +------------------------------------------------+
     |                   test   test1   test2   test3 |
     |------------------------------------------------|
  1. | frogXOOD_toadXOOD_newt    frog    toad    newt |
     +------------------------------------------------+

Have you got strange characters in your variable? -charlist- (SSC) as
recently discussed here is one diagnostic tool.
Nick
[email protected]


On 5 March 2014 09:12, Sebastian Say <[email protected]> wrote:
> Hi I have a string variable called cofiler, in which the cell contains
> names of organizations all separated by "XOOD_".
>
> When i tried to use the split var, parse (XOOD_) option, it shows
> cofiler1, cofiler2....cofiler42 generated.
>
> My guess is at least 1 cell has 42 names, each separated by XOOD_
>
> However, when I looked at these generated variables, it seems that
> they are all empty.
>
> When I browsed the data, in the original string variable that was to
> be splitted, it shows only 1 organization's name in any cell. However,
> when I click onto each of these cells, I can see multiple names in the
> display bar at the top.
>
> My question is, what's causing this problem? And what have I done
> wrong such that when I tried to parse the string variable, nothing
> shows up but variables were indeed generated?
>
> Best,
> Sebastian
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index