Well I have tried sql join and CASE statement but was not able to get this to work.
A simple UNION will produce results I believe you are looking for and could work with one of the SQL based transformations such as JOIN.
Sample query is below:
proc sql;
create table work.pol_aug_2018_update as
select t2.policy_id,
t2.knkatd,
t2.policy_issue_dt,
t1.kndatl as kndatl format=ddmmyyd10.
from work.pol_jul_2018 as t1,
work.pol_aug_2018 as t2
where t1.policy_id = t2.policy_id and
missing(policy_issue_dt) and
t1.knkatd = t2.knkatd
union
select t2.policy_id,
t2.knkatd,
t2.policy_issue_dt,
intnx ('month', t1.kndatl, 0, 'E') as kndatl format=ddmmyyd10.
from work.pol_jul_2018 as t1,
work.pol_aug_2018 as t2
where t1.policy_id = t2.policy_id and
missing(policy_issue_dt) and
t1.knkatd ne t2.knkatd;
quit;
... View more