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
svy: mean and svy: reg give different results - why?Hello, I have a simple case of survey data and am puzzled why svy: mean, over gives me different res…
ivreghdfeHello professor I have a question, I remember the R2 range in 0~1 range in 0~1 why I got a minus R2 …
Reduce margin (y-scale) around scatter plotI am struggling to reduce the margin area around a scatter plot. I like to present results on the sa…
scatter line plotHow do I create a scatter connected graph between three groups and simultaneously add a mean with st…
Structural breaksHi, I am performing the Johansen cointegration test in Stata16. Before going to the test I have perf…
Subscribe to:
Post Comments (Atom)
0 Response to Replace string with a variable while leaving empty another string variable
Post a Comment