如何用stata挑出包含某个字符串的记录?

2025-05-20 20:11:00
推荐回答(1个)
回答1:

excel中ctrl+f和sql中select可以做到查找出字符变量中包含某一个特定字符的变量

stata中的第一个方法: regexm

例子:

sysuse  auto.dta,clear
keep  if  regexm(make,"BMW")==1

stata中的第二个方法: strmatch

例子:

sysuse  auto.dta,clear
keep  if  strmatch(make,"*BMW*")