Hi,
I have data of the following form:
clear
input id month s_01 s_02 s_03 s_04 s_05 s_06 s_07 s_08 s_09 s_10 s_11 s_12
101 5 0 0 0 0 1 1 1 1 1 1 1 1
102 2 1 0 0 0 0 1 1 1 1 1 1 1
end
Month is the month the patient was admitted to the institution, s_01 stands for the status of the patient in a January, s_02 is their status in February and so on, the variable stands for whether they were insured in that month. I want to construct a new variable that equals to whether or not the patient was insured in the month they were admitted. i.e. for patient 101 the value should be 1 and for patient 102 the value should be 0. Is there a way to do this without having to reshape the data to long form first?
Thanks.
Best,
Angela
I have data of the following form:
clear
input id month s_01 s_02 s_03 s_04 s_05 s_06 s_07 s_08 s_09 s_10 s_11 s_12
101 5 0 0 0 0 1 1 1 1 1 1 1 1
102 2 1 0 0 0 0 1 1 1 1 1 1 1
end
Month is the month the patient was admitted to the institution, s_01 stands for the status of the patient in a January, s_02 is their status in February and so on, the variable stands for whether they were insured in that month. I want to construct a new variable that equals to whether or not the patient was insured in the month they were admitted. i.e. for patient 101 the value should be 1 and for patient 102 the value should be 0. Is there a way to do this without having to reshape the data to long form first?
Thanks.
Best,
Angela
Comment