Hello Everyone,
I have looked across the forum but am unable to find an answer to my question.
I am trying to create a new categorical variable which will give me one of 20 "Phase" based on whether the date of admission and date of discharge of a patient are within two specific dates which are varying and associated to a specific phase.
I arrived at the step where I formulated the conditions as sentences but have not been succesful in converting it into stata code so far.
The two conditions are:
1) If DateofAdmission is after beginning of Phase and Dateofdischarge is before endofphase then assign to the previous phase
2) If DateofAdmission is after beginning of Phase and Dateofdischarge is after endofphase then assign to the current phase.
All this for different facilities with different phase names
So far I think i was able to get the beginning of the code but don't know how to continue:
gen NewAssPh_cat = "PhaseName" if DateofAdmission>td(15dec2020) & DateofDischarge<td(1oct2021) & facilityname_cat==2
Hope someone can help !
Thank you in advance.
I have looked across the forum but am unable to find an answer to my question.
I am trying to create a new categorical variable which will give me one of 20 "Phase" based on whether the date of admission and date of discharge of a patient are within two specific dates which are varying and associated to a specific phase.
I arrived at the step where I formulated the conditions as sentences but have not been succesful in converting it into stata code so far.
The two conditions are:
1) If DateofAdmission is after beginning of Phase and Dateofdischarge is before endofphase then assign to the previous phase
2) If DateofAdmission is after beginning of Phase and Dateofdischarge is after endofphase then assign to the current phase.
All this for different facilities with different phase names
So far I think i was able to get the beginning of the code but don't know how to continue:
gen NewAssPh_cat = "PhaseName" if DateofAdmission>td(15dec2020) & DateofDischarge<td(1oct2021) & facilityname_cat==2
Hope someone can help !
Thank you in advance.