Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge all values into one variable

    After I split a string, I would like to paste all the values from all the variables into the first and get a long word list. Right now I am doing it rather cumbersome by saving each variable as a separate dataset and then appending them. However, this requires me to use preserve and now I have run into a bottleneck because I am doing this procedure within a preserve.

    Is there a simpler way to split and stack words from a string?

  • #2
    You don't give example data, so this is untested. But if it has errors, you can adapt it; the gist of this is correct:

    Code:
    split string_variable, gen(word)
    gen `c(obs_t)' obs_no = _n
    reshape long word, i(obs_no)

    Comment


    • #3
      See also tabsplit from tab_chi on SSC.

      Comment


      • #4
        2 works excellently, thank you!

        Comment

        Working...
        X