Features: |
joined-table component left outer join SELECT clause : COALESCE function WHERE clause : CONTAINS condition |
Table names: | PROCLIB.PAYROLL |
libname proclib 'SAS-library';
proc sql outobs=10;
title 'Most Current Jobcode and Salary Information';
select p.IdNumber, p.Jobcode, p.Salary, p2.jobcode label='New Jobcode', p2.salary label='New Salary' format=dollar8.
from proclib.payroll as p left join proclib.payroll2 as p2
on p.IdNumber=p2.idnum;
select p.IdNumber, p.Jobcode, p.Salary, p2.jobcode label='New Jobcode', p2.salary label='New Salary' format=dollar8.
proc sql outobs=10;
title 'Most Current Jobcode and Salary Information';
select p.idnumber, coalesce(p2.jobcode,p.jobcode) label='Current Jobcode',
coalesce(p2.salary,p.salary) label='Current Salary' format=dollar8.
from proclib.payroll p left join proclib.payroll2 p2 on p.IdNumber=p2.idnum;
proc sql; title 'Most Current Information for Ticket Agents'; select p.IdNumber, coalesce(p2.jobcode,p.jobcode) label='Current Jobcode', coalesce(p2.salary,p.salary) label='Current Salary' from proclib.payroll p left join proclib.payroll2 p2 on p.IdNumber=p2.idnum where p2.jobcode contains 'TA';