Hello, i am working with treatment data i have treatment1 treatment2 treatment3 treatmentn variables which contain the name of the drugs taken by the patient.
i wish to generate a variable that would be called antihypertensives that would take the value 1 if any of treatment1 treatment2 treatment3 treatmentn lists any of a long list of antihypertensive molecules.
i tried looping and strpos as under
for each treatment of varlist treatment1 treatment2 treatment3 {
gen antihypertensive=1 if strpos(`treatment', ""ATENOLOL" "NICARDIPINE" "BISOPROLOL" "IBERSARTAN" "HYDROHLOROTHIAZIDE" )>0
}
i get an error message r(198)
what is the solution for this problem?
thanks for your help
Related Posts with extracting several string values from several different variables
bootstrap likelihood ratio OR Lo-Mendell-Rubin adjusted likelihood ratio testDear Statalisters, Please I am looking for your help to obtain the syntax in order to calculate boo…
Different results xtmelogit vs. melogitDear all, This is my first post. I read the FAQ and I hope I am not breaking the rules. Here are t…
Assigning preferred IDs to to District Names of a large Panel DatasetHello, I have year-wise data files which have household level data on wide-ranging variables. The pr…
Using only end of month values for a daily dataset?Hey I have a dataset in this format: Date(daily) var1 var2 var3 var4 var5 I only want to work wit…
Replacing missing values with the mean by group via a loopHello, I have a large dataset of 59,000,000 observations. There are a 50 variables each beginning …
Subscribe to:
Post Comments (Atom)
0 Response to extracting several string values from several different variables
Post a Comment