This operation is straightforward with SQL proc sql; create table want as select a.patient, a.ear, a.date, b.date as previousDate, a.db, b.db as previousDb from have as a inner join have as b on a.patient=b.patient and a.ear=b.ear and a.date>b.date and a.db <= b.db-10; select * from want; quit; PG
... View more