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
Difference in Sargan after xtdpdsysIs it possilbe to compute difference in Sargan after xtdpdsys ? …
Regression Discontinuity Design for change in speed limitsHey! I`m trying to get graphs for my panel data. I`m looking to graph with a regression discontinui…
Reduce space between category in a graphHi all, I wonder how reduce the space between category in a graph, example: Code: clear all set m…
Chi-square problemHi! Help please! I have a table with variables "speciality", "city", and "status". I need to compare…
Calculating ratio with confidence intervalDear All, Do you perhaps have any advice on how to calculate the ratio with 95% confidence interval…
Subscribe to:
Post Comments (Atom)
0 Response to extracting several string values from several different variables
Post a Comment