/  2
 
SAS Table Joins Tutorial & Demonstrations
 – Tom TuducInner Join, Right Join, Left Join, and Full Join.This tutorial demonstrates various table joins in SAS with SQL codes and results.
Sample Data
Table
Measurement
PersonIdWeightHeight11335.731235.44985.551555.961586.1Table
Patient
PersonIdNameGenderCity1Mike J.mPortland2Ann K.fSalem3Trish L.fEugene7Tom KmPortland9Lance T.mPortland
 
INNER JOIN
proc sql;select Patient.PersonID,Height,Name,Genderfrom Measurement, Patientwhere Measurement.PersonId = Patient.PersonId;quit;
Results:
PersonIdHeightNameGende15.7Mike J.m35.4Trish L.
RIGHT JOIN, LEFT JOIN, and FULL JOIN
proc sql;title " Performing Right Join";select p.PersonId as Patient_PersonId ,m.PersonId as Measurement_PersonId,Heightfrom learn.Patient as p right joinlearn.Measurement as mon p.PersonId eq m.PersonId;title " Performing Left Join";

Share & Embed

More from this user

Add a Comment

Characters: ...