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.
0 Response to How can I create one binary variable that =1 if an observation contains one of multiple substrings?
Post a Comment