Hi, I want to create a binary variable that =1 if an observation within var1 contains certain substrings. It is survey data, and I am looking for a particular word, however, it is often misspelt, so I am looking to search for all possible spelling combinations.
I am using:
foreach word in xx xy xz { egen `word' = incss(var1), sub(`word') insensitive } Which works, but it creates a separate variable for each combination, I only want to create one variable for each variation of the spelling. Thanks.
Related Posts with How can I create one binary variable that =1 if an observation contains one of multiple substrings?
Teffect psmatch with sample weightsI am using propensity score matching on data that requires using sample weights. The data comes from…
Lagged non-linear independent variablesI came across a paper that write the following: The first set of independent variables, REPRESSION(1…
Why might Clopper Pearson CIs differ in Stata vs SAS output?Hello, I am currently using Stata to replicate an analysis with complex svy data to obtain weighted…
Plotting residuls for first and second stage of "SLSDear Stata experts, i am using 2sls to estimate the impact of water quality on health with state 14…
Teffect psmatch with sample weightsI am using propensity score matching on data that requires using sample weights. The data comes from…
Subscribe to:
Post Comments (Atom)
0 Response to How can I create one binary variable that =1 if an observation contains one of multiple substrings?
Post a Comment