Dear Forum-Users,
I have a data set in long format – combining prescription data and dates of visits which looks like this – except for the „newvar“ – which I would like to obtain.
What I want to do is „check“ whether each patient (patID) has been - for each prescription (prescDATE) - to the doctor who issued the prescription (docID) within a certain timeframe (lets say five days before or after the prescription date). If this is true, the "newvar" should count the visits within that timeframe.
I guess one solution would be to convert the dataset in the wide format and loop through the prescription dates?
I m looking for a clue how this could be handled in the long format?
Many Thanx, Lynde
I have a data set in long format – combining prescription data and dates of visits which looks like this – except for the „newvar“ – which I would like to obtain.
|
I guess one solution would be to convert the dataset in the wide format and loop through the prescription dates?
I m looking for a clue how this could be handled in the long format?
Many Thanx, Lynde