I have data of a longitudinal study, where every patient goes through a series of processes. For each step, a patient gets a status code. For e.g., if there are 5 steps from A to Z, a patient go from step 1 to step 2 to step 3 and so on in a serial order. However, some patients can go from step 1 to a higher step by jumping few steps in between. My desired output is the understand the flow of patients. How can I do it? One can use the lowest "visit number" as status code for step 1 and the "largest visit number" for the final step. [Important Note: Not all patients go through= similar number of steps].
Thanks.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str7 patientid str2 status_code byte visit "10-915" "RI" 1 "10-915" "RC" 2 "10-915" "ER" 3 "10-986" "RI" 1 "10-986" "RC" 2 "11-1050" "RI" 1 "11-1050" "RC" 2 "11-1050" "ER" 3 "11-1050" "ER" 4 "11-1050" "UV" 5 "11-1050" "ER" 6 "2-109" "RI" 1 "2-109" "ER" 2 "2-109" "RC" 3 "2-109" "DC" 4 "2-128" "RI" 1 "2-128" "RC" 2 "2-128" "ER" 3 end
Comment