I want to build a cohort，about patients with anemia in three months after heart failure，to estimate differences of mortality between oral and injectable iron supplementation. But i do not know how to bring out the date interval ，3 months，between anemia and heart failure in the initial events cohort. thank you vary much。
Use nested criteria:
condition occurrence of anemia having: _this is the nested criteria_ all of the following criteria: at least 1 condition occurrence of heart failure starting between 90d before and 1 day before index
It’s not clear from your description if you are saying that you want the anemia to be after 3 months from the heart failure, or if you mean that you had the heart failure within the 3 months of the anemia.
If you wanted to say that you had a heart failure, then 3 months of no heart failure and then anemia you could do:
condition occurrence of anemia having: _this is the nested criteria_ all of the following criteria: at least 1 condition occurrence of heart failure starting between all days before before and 31 days before index and exactly 0 condition occurrence of heart failure starting between 30 days before index and 1 day before index.
The latter example is a combination of criteria: first says you had the heart failure sometime > 30d before anemia and the second says that you also can’t have any heart failure in the 30d prior to anemia. I’m not sure that is what you want, I’m just describing the use case.