From 1f2ce55f249f4af56f0cacdec47e69246cd47431 Mon Sep 17 00:00:00 2001 From: Allan Date: Fri, 25 Aug 2023 12:17:43 +0100 Subject: [PATCH] fix: updating logic for REPLACE loadtype Staged rows are always considered as NEW, and previous rows are considered DELETED This is consistent with the fact that REPLACE involves a delete *, followed by an append. --- sas/sasjs/macros/mpe_targetloader.sas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sas/sasjs/macros/mpe_targetloader.sas b/sas/sasjs/macros/mpe_targetloader.sas index 2d41889..52ea11b 100755 --- a/sas/sasjs/macros/mpe_targetloader.sas +++ b/sas/sasjs/macros/mpe_targetloader.sas @@ -142,10 +142,14 @@ run; %mp_lockanytable(UNLOCK,lib=&lib,ds=&ds,ctl_ds=&dclib..mpe_lockanytable) %end; %else %do; - /* is full replace so treat everything as a mod in diff screen */ - data work.outds_mod work.outds_add work.outds_del; + /* is full replace so treat all staged records as new in diff screen */ + data work.outds_mod work.outds_add ; set work.&staging_ds; - output work.outds_mod; /* _add and _del will be empty */ + output work.outds_add; + run; + /* previous table will be considered fully deleted */ + data work.outds_del; + set &lib..&ds; run; %end; %end;