hello everyone i have a small dataset with diseases A, B and C which can have different severity scores ranking from 1 to 4. according to disease and sevirty score there is a theoretical length of stay. in addition there is a social precariousness score coded 0 or 1.
i would like to generate a new length of stay that would actually correspond to the length of stay in the next severity category when the social precariousness score is 1. i have been struggling with explicit subscripting, replace, using st or ts commands...
does anyone have a clean way of doing this
here is an example data set (the real one is much much larger...)
Thanks
Mat
Disease severityscore length of stay social score new length of stay
A 1 3 1
A 2 4 0
A 2 4 1
A 3 5 0
A 3 5 1
A 3 5 1
A 4 7 1
B 1 2 1
B 2 4 0
B 2 4 1
B 2 4 1
B 3 5 1
C 1 2 0
C 2 4 0
C 3 5 1
C 4 6 1