Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下形式的数据
姓名1,姓名2,姓名3,姓名4
都在一栏。我正在尝试将所有名称分成各自的列。
到目前为止,我有:
gen Songwriter1 = regexs(1) if regexm(Songwriter, "(.*)[,]")
它给出了“,”之前的所有值
有没有办法指定我想要第一个“,”和第二个“,”之间的值?等等?
如果您有 Stata 8 或更高版本,您可以尝试:
split Songwriter, p(,)
split给定Songwriter并将p(,)解析(拆分)逗号并将这些逗号丢弃。它将创建Songwriter1,Songwriter2等。
split
Songwriter
p(,)
Songwriter1
Songwriter2