Not sure if I understand what all your variables mean, so I'm "creating" admit_date to stand in for what you said you wanted from the tables. Also, I'm assuming that patients can be admitted more than once in a year.
proc sql;
create table CRG.new as
select a.patientid, a.sex, a.birthdate, a.sponssn,
min(a.admit_date) as first_admit_date,
max(e.admit_date) as last_admit_date,
from CRG.fy10_crg2 as a,
CRG.fy11_crg2 as b,
CRG.fy12_crg2 as c,
CRG.fy13_crg2 as d,
CRG.fy14_crg2 as e
where a.patientid=b.patientid=c.patientid=d.patientid=e.patientid
group by a.patientID, a.sex, a.birthDate, a.SponSSN;
quit;
Also, another syntax for the join:
proc sql;
create table CRG.new as
select a.patientid, a.sex, a.birthdate, a.sponssn,
min(a.admit_date) as first_admit_date,
max(e.admit_date) as last_admit_date,
from CRG.fy10_crg2 as a
join CRG.fy11_crg2 as b on b.patientID = a.patientID
join CRG.fy12_crg2 as c on c.patientID = a.patientID
join CRG.fy13_crg2 as d on d.patientID = a.patientID
join CRG.fy14_crg2 as e on e.patientID = a.patientID
group by a.patientID, a.sex, a.birthDate, a.SponSSN;
quit;
... View more