Hello everyone,
sorry to request such trivial questions but i am a rookie in stata.
I have a big longitudinal dataset and would love to clean my dataset and select the patients who received a certain strategy of treatment for the 3 possible lesions (cplx_strategy_of_pci___1, 2 and 3).
Furthermore, each patients might have had several procedures (index, proc_2, proc_3) in which the treatment might have been used or not, again for each lesion (max 3 times)
Each patient then had his/her follow-up where off course under "strategy" a missing value is showing.
an example (not exactly the same of mine for sake of time)
id--event_name--strategy--strategy_2--strategy_3
1---index ----------1 ----------1 -------------.
1---proc_2 --------0 ----------0 -------------.
1---proc_3 --------. -----------. --------------.
1---180d_fu -------. ----------. --------------.
1---1y_fu ----------. -----------. --------------.
1---2y_fu ----------. -----------. --------------.
2---index ----------1 ----------0 -------------1
2---1y_fu ----------. -----------. --------------.
2---2y_fu ----------. -----------. --------------.
3---index ----------0 ----------0 --------------.
3---1y_fu ----------. -----------. --------------.
3---2y_fu ----------. -----------. --------------.
i tried to use this command:
drop if cplx_strategy_of_pci___2 == 0 & cplx_strategy_of_pci_3___2 == 0 & cplx_strategy_of_pci_2___2 == 0
this way i select only my strategy of interest which is fine for id 1 and 2 for example, but i drop only the "index" procedure for patient 3 and the follow ups remain and mess up my calculations.
I tried to think of a solution but i am too noob for this.
Could you please help me out?
thank you very much in advance
sorry to request such trivial questions but i am a rookie in stata.
I have a big longitudinal dataset and would love to clean my dataset and select the patients who received a certain strategy of treatment for the 3 possible lesions (cplx_strategy_of_pci___1, 2 and 3).
Furthermore, each patients might have had several procedures (index, proc_2, proc_3) in which the treatment might have been used or not, again for each lesion (max 3 times)
Each patient then had his/her follow-up where off course under "strategy" a missing value is showing.
an example (not exactly the same of mine for sake of time)
id--event_name--strategy--strategy_2--strategy_3
1---index ----------1 ----------1 -------------.
1---proc_2 --------0 ----------0 -------------.
1---proc_3 --------. -----------. --------------.
1---180d_fu -------. ----------. --------------.
1---1y_fu ----------. -----------. --------------.
1---2y_fu ----------. -----------. --------------.
2---index ----------1 ----------0 -------------1
2---1y_fu ----------. -----------. --------------.
2---2y_fu ----------. -----------. --------------.
3---index ----------0 ----------0 --------------.
3---1y_fu ----------. -----------. --------------.
3---2y_fu ----------. -----------. --------------.
i tried to use this command:
drop if cplx_strategy_of_pci___2 == 0 & cplx_strategy_of_pci_3___2 == 0 & cplx_strategy_of_pci_2___2 == 0
this way i select only my strategy of interest which is fine for id 1 and 2 for example, but i drop only the "index" procedure for patient 3 and the follow ups remain and mess up my calculations.
I tried to think of a solution but i am too noob for this.
Could you please help me out?
thank you very much in advance
Comment