Dear all,
I have 4 string variables= medicine1, medicine2, medicine3, and medicine4. Each of them contains a name of a medicine (string). I would like to create a new variable called medicine_all which combines the name of the medicines from the 4 variables. I used:
egen medicine_all = concat (medicine1-medicine4), decode p(",")
In general, it gives the result that I want. But it also gives me a value of ",,,," when all the medicines are empty. Is there any way to ask Stata to return me "blank" or "missing" if all the medicines variables are missing?
Thank you in advance.
Vini
I have 4 string variables= medicine1, medicine2, medicine3, and medicine4. Each of them contains a name of a medicine (string). I would like to create a new variable called medicine_all which combines the name of the medicines from the 4 variables. I used:
egen medicine_all = concat (medicine1-medicine4), decode p(",")
In general, it gives the result that I want. But it also gives me a value of ",,,," when all the medicines are empty. Is there any way to ask Stata to return me "blank" or "missing" if all the medicines variables are missing?
Thank you in advance.
Vini
Comment