I'm trying to save observations inside a one year interval per id in SAS.
I have different amounts of obsevations per id. Each observation has a visit date called date1 and a reference date called datum_sistahandelse(wich do not change over observations per id, but changes between ids). The dates are in format YYYY-MM-DD. I want to keep only the observations where date1 is later than datum_sistahandelse but no more than a year later. So if for ID #1 datum_sistahandelse=2014-02-03 then i want to keep all observations where date1 is between 2014-02-04 and 2015-02-04. And for ID #2 datum_sistahandelse=2015-05-13 i want to keep all observations where date1 is between 2015-05-14 and 2016-05-14. And so on
Thanks