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]

st: Spliting a variable: Reposting


From   "Mike Kim" <kalisperos@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Spliting a variable: Reposting
Date   Wed, 7 Dec 2011 17:35:12 -0600

Sorry, again. My data structure in the previous posting seems all broken.

I have a question about splitting a variable. My data look like this:

clear 
input str40 author str80 school
"Aguin, H; Ju, H; Gottfred, RK"	"[Aguin, H; Ju, H; Gottfred, RK] Indiana U"
"Bell, T"	"Drexel U"
"Buck, MR; Novice, MM; Robert, F; Hump, JH"	"[Buck, MR] U Oklahoma;
[Novice, MM; Robert, F] U Mississippi; [Hump, JH] Texas U"
"Kohli, C; Juri, R"	"[Kohli, C] Calif U; [Juri, R] Kansas U"
end

I would like to change into the following form. I tried the following, but
it is not easy to change into this form. Can anyone please help?
split school, p(";" "]")

clear
input str30 author str30 school
"Aguin, H"     "Indiana U"
"Ju,H"           "Indiana U"
"Gottfred, RK"  "Indiana U"
"Bell, T"          "Drexel U"
"Buck, MR"     "U Oklahoma"
"Novice, MM" 	"U Mississippi"
"Robert, F"    "U Mississippi"
"Hump, JH"   "Texas U"
"Kohli, C"      "Calif U"
"Juri, R"        "Kansas U"
end

Thanks in advance.
Mike.


*
*   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