Dear all,
I have different variables indicating different names of health providers (prov1, prov2 etc.).
Each observation is a patient and he/she could have seen 1,3..7 health providers.
Some fields were mistakenly filled in from the second provider skipping the first provider variable which results in missing.
How can I replace the correct values in prov1 and prov2 while replacing the values in prov2 and prov3 at the same time ?
To explain myself better:
list prov1 prov2 prov3 prov4 prov5 prov6 prov17 if prov1=="" & prov2!=""
+---------------------------------------------------------------------+
1927. | prov1 | prov2 | prov3 | prov4 | prov5|| prov6 | prov7 |
------| . | Hospital 1 | Clinic 3 |
2383. | prov1 | prov2 | prov3 | prov4 | prov5 || prov6 | prov7 |
------| . | Hospital 4 |
then I will do :
replace prov1=prov2 if prov1=="" & prov2!="" //2 changes
but in obs. 1927 i want the value of prov2 to assume the value of prov3 and prov3 should assume the value of prov4 too.
I would very much appreciate your help.
Thank you.
Jules
Related Posts with Replace string with a variable while leaving empty another string variable
comparing sample medians at three time pointsHi, I would like to compare median z scores for weight at birth versus one month of age versus one y…
Help needed: Automate extracting of dataHi all, I am using Stata 16 and I need some help in automating the process of extracting data. I am…
replacing observations within groupsHello everyone, I have a dataset where I have several text_rules belonging to text types inside dif…
how to include random intercept in predicted margins and plot after mi estimate: mixedHi all, I've got a dataset of students in schools for which I've imputed 20 datasets, and I'm estim…
How interpret subgroup analysis output not report heterogeneity statistics for some groups?I wonder how to interpret the following heterogeneity statistics for subgroup analysis Array …
Subscribe to:
Post Comments (Atom)
0 Response to Replace string with a variable while leaving empty another string variable
Post a Comment