Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id mob_1 mob_2 mob_3 mobnew) 1 1 0 0 . 2 1 0 0 . 3 0 1 0 . 4 0 1 0 . end
HI, I hope I’ll make my self clear
I have the following variables
Id - id of the patient
mob_1, mob_2, mob_3
These are mobility variables. Where by the numbers represent the value of the points within mobility.
Therefore if mob_1= 1 then mobility=1
If mob_2 = 1 then mobility=2
If mob_3 = 1 then mobility = 3
I would like to create a new variable mobility which will join all 3 mob* together
Which means that if for eg
ID=1 and mob_1 = 1 then mobility = 1
ID=2 and mob_2=1 then mobility=2
I have checked the data are for each ID only one of the mob_* = 1
So there will not be a situation whereby
mob_1 = 1 and mob_2 = 2
I would appreciate your advice
Comment