Thank you! However, it doesn't seem to be giving me what I am looking for. When I use either of the sql statements it only gives me the first observation for each beneficiary_id, which is not what I am trying to get. This makes me think I am explaining myself poorly. The merge in a one-to-many where beneficiary_ids match. So, in medicare_proc, I have one observation for a beneficiary_id but that beneficiary_id has many matches in medicare_final. I want those additional observations in medicare_final but ONLY if the beneficiary_ids match and the admission_date in medicare_final is greater than within 365 days of the admission_date in medicare_proc.
For example:
medicare_proc medicare_final medicare_all
id admission_date id admission_date id admission_date
1 03MAR2003 1 03FEB2003 1 03MAR2003
1 03MAR2003 1 03MAY2003
1 03MAY2003
Merging medicare_proc and medicare_final would give me medicare_all.
Hopefully that makes more sense. Clearly neither of my sas or sql skills are great so I appreciate the help!
... View more