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
Panel data: How to drop only a specific combination of observations?Hi. I am using large n panel data with four annual waves, from which I want to exclude/drop data. I…
Help generating and analysing a repeated variable conditional on a specific baseline time-point and value.Hi Stata Forum I have an unbalanced set of panel data with individuals having a measurement at base…
removing 2-digit sic-codes with <10 companiesHi there, I am trying to remove 2-digit sic codes for which my dataset has less than 10 companies. …
Appending of one variable doesn't workDear users, I have appended a data set to my master data set, but somehow the German states (Bundes…
Group averages and assign them to a specific dateHi, I am trying to make average of the median EPS that have been forecasted 90 days before the earn…
Subscribe to:
Post Comments (Atom)
0 Response to extracting several string values from several different variables
Post a Comment