Hello SweetPeaIndeed,
It is better to use proc SQL in this case like this:
[pre]
proc SQL;
create table medicare_proc_all as
select a.*, b.* /* list fields you need from both tables */
from medicare_proc_first as a, medicare_final as b
where a.beneficiary_id=b.beneficiary_id and
b.admission_date-365 LE a.admission_date LT b.admission_date
;quit;
[/pre]
Since both datasets contain the same variables like beneficiary_id, admission_date and may be some others it is necessary to list all necessary variables in the select clause.
Sincerely,
SPR
... View more