I want to replace the values of variable with conditions. This is the example of my data.
Code:
clear input long ID int LOS float weight str5 caretype 7811 41 0 "4A91" 1013 9 0 "4A91" 487 7 0 "4AH2" 2172 12 0 "4A91" 147 15 0 "4AH4" 2703 7 0 "4A91" 4692 8 0 "4AR4" 7423 1 0 "4A91" 1219 13 0 "4A91" 98748 27 0 "4A91" end
- weight = 0.8 if (18.96+15.08)/2 <= LOS <= (25.28+18.96)/2 & caretype ="4A91"
- weight = 0.8 + 0.06*(LOS - 19) if LOS > (25.28+18.96)/2 & caretype ="4A91"
- weight = 0.078*LOS if LOS < (18.96+15.08)/2 & caretype ="4A91"
Could you kindly show me how to do this?
Thank you so much
0 Response to Help with replacing values of variable with conditions
Post a Comment