提取逗号后的子字符串
Extracting substring after comma
我在 Stata 中有一个名为 place
的变量,其中的条目看起来像 "Wichita, Kansas"
。
我想将此变量拆分为 city
和 state
变量。状态总是在逗号和 space.
之后
input str20(place)
"Wichita, Kansas"
"Salt Lake City, Utah"
"Buffalo, New York"
end
split place, p(",")
list
+---------------------------------------------------+
| place place1 place2 |
|---------------------------------------------------|
1. | Wichita, Kansas Wichita Kansas |
2. | Salt Lake City, Utah Salt Lake City Utah |
3. | Buffalo, New York Buffalo New York |
+---------------------------------------------------+
我在 Stata 中有一个名为 place
的变量,其中的条目看起来像 "Wichita, Kansas"
。
我想将此变量拆分为 city
和 state
变量。状态总是在逗号和 space.
input str20(place)
"Wichita, Kansas"
"Salt Lake City, Utah"
"Buffalo, New York"
end
split place, p(",")
list
+---------------------------------------------------+
| place place1 place2 |
|---------------------------------------------------|
1. | Wichita, Kansas Wichita Kansas |
2. | Salt Lake City, Utah Salt Lake City Utah |
3. | Buffalo, New York Buffalo New York |
+---------------------------------------------------+