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
0 Response to Replace string with a variable while leaving empty another string variable
Post a Comment