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
New command -oaxaca_rif-Dear all, Thanks to Prof. Baum a new command named oaxaca_rif is now available in the SSC archive. T…
Help with output/results window cutting off variable namesMy variable names are not shown in full, is there any way of getting Stata to tabulate so the output…
De trending// De seasonalising data - find weekly meanHiya, for my project i have daily stock market data (returns and volatility) and daily weather (clo…
Quicker way to export correlation coefficients into Excel?Hello, I am running correlations over hundreds of variables and storing the output of the correlatio…
IDs in different categories : how to count ?Dear statalist members, I have a sample of about 1 million people (id) with one or more records in …
Subscribe to:
Post Comments (Atom)
0 Response to Replace string with a variable while leaving empty another string variable
Post a Comment