*creates temporary work file named ‘death” with death information from mdr server;
DATA death (keep = sponssn patssn dob dds dthdate source edipn);
SET "/mdr/pub/death/master/mpidth"; *may need to add .sas7bdat to data file name;
if patssn ne "";
format dob dthdate mmddyy10.;
RUN;

*matches file from death file to cohort file, matching on the beneficiary ssn.  Cohort file used the variable name “benssn” while the death file used “patssn” for the same variable.
PROC SQL;
CREATE TABLE cohort_death AS
SELECT *
FROM cohort as a, death as b
WHERE a.benssn=b.patssn
;
QUIT;