Hi, I'm new to Stata and would like to know how to condition on a string variable. I have a variable 'drugs' with names of different drugs e.g., paracetamol, penicillin etc. I want to create new variables as 'Paracetamol' or 'Antibiotics' where I want to flag as '1' the respective drug e.g.
gen paracetamol = 1 if drugs=="paracetamol" | "paracet" | "panadol" | "padol"
gen antibiotics = 1 if drugs=="penicillin" | "amoxicillin" | "antibio"



While I'm trying to do it, I get the error 109 (type mismatch). I get the same error even after encoding the 'drugs' variable as a new variable "drugs_new".
Kindly help!