Is there a way to group in Stata with specific requirements? For example, I want to create a binary variable that is true if the world agriculture is in the text but I don't want it to include agriculture engineering.
Here is a method I tried that does not work. The error says its invalid.
Code:
gen agriculture = 0 replace agriculture = 1 if strpos(department, "Agriculture" ) & != "Engineering"
0 Response to Grouping in Stata if it does not include a specific word
Post a Comment