Hi there,
I am working with hospital data that spans a few years and need to drop patients that have their first visit in 2017. I've sorted my data by ID and date and used the egen tag = tag (ID) command to tag the first observation for each participant.
This is the code I'm working but unfortunately it's dropping both tag == 1 AND Date >=2017, not the combination of the two. I.e. it's dropping way too many observations.
Please advise how to properly combine multiple if statements when using the drop command.
Thank you!
- K
I am working with hospital data that spans a few years and need to drop patients that have their first visit in 2017. I've sorted my data by ID and date and used the egen tag = tag (ID) command to tag the first observation for each participant.
This is the code I'm working but unfortunately it's dropping both tag == 1 AND Date >=2017, not the combination of the two. I.e. it's dropping way too many observations.
Code:
drop if tag == 1 & Date >=2017
Thank you!
- K
Comment