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
Standardised independent variables using logistic regressionI am running a model in which I want to check the substantive effect of the different independent va…
regression of the panel data: dependent variable and independent variable is the same variable in different groupHi, I am now running a panel regression, for example, return in year 2018=c+return in year 2010-2017…
the exponential model, using the NLS, poisson and gamma QML estimatorsDear all, I have a question related to the estimation of the exponential model. This is related to …
help me whit stata commanddear statalist it's my first job with been I'm not very practical I am working on a panel data to …
RescalingHi Statlist! Is there a way to rescale the x and y axis in order to show them in in Millions dollar…
Subscribe to:
Post Comments (Atom)
0 Response to extracting several string values from several different variables
Post a Comment