mirror of
https://github.com/sasjs/core.git
synced 2026-01-03 23:50:06 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96e8b096c5 | ||
|
|
7413266a8e | ||
|
|
cf70c33bde |
15
all.sas
15
all.sas
@@ -13393,7 +13393,7 @@ run;
|
|||||||
|
|
||||||
@li deleted rows - these are re-inserted
|
@li deleted rows - these are re-inserted
|
||||||
@li changed rows - differences are reverted
|
@li changed rows - differences are reverted
|
||||||
@li added rows - these are marked with `_____DELETE_THIS_RECORD_____="YES"`
|
@li added rows - marked with `_____DELETE__THIS__RECORD_____="YES"`
|
||||||
|
|
||||||
These changes are NOT applied to the base table - a staging dataset is
|
These changes are NOT applied to the base table - a staging dataset is
|
||||||
simply prepared for an ETL process to action. In Data Controller, this
|
simply prepared for an ETL process to action. In Data Controller, this
|
||||||
@@ -13409,7 +13409,7 @@ run;
|
|||||||
in mddl_dc_difftable.sas
|
in mddl_dc_difftable.sas
|
||||||
@param [out] outds= (work.mp_stripdiffs) Output table containing the diffs.
|
@param [out] outds= (work.mp_stripdiffs) Output table containing the diffs.
|
||||||
Has the same format as the base datset, plus a
|
Has the same format as the base datset, plus a
|
||||||
`_____DELETE_THIS_RECORD_____` variable.
|
`_____DELETE__THIS__RECORD_____` variable.
|
||||||
@param [in] mdebug= set to 1 to enable DEBUG messages and preserve outputs
|
@param [in] mdebug= set to 1 to enable DEBUG messages and preserve outputs
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@@ -13505,7 +13505,7 @@ run;
|
|||||||
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
|
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
|
||||||
proc transpose data=&ds2(where=(tgtvar_type='C'))
|
proc transpose data=&ds2(where=(tgtvar_type='C'))
|
||||||
out=&ds3(drop=_name_);
|
out=&ds3(drop=_name_);
|
||||||
by KEY_HASH;
|
by KEY_HASH PROCESSED_DTTM;
|
||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var charval;
|
var charval;
|
||||||
run;
|
run;
|
||||||
@@ -13513,7 +13513,7 @@ run;
|
|||||||
%let ds4=%upcase(work.%mf_getuniquename(prefix=mpsd_keynum));
|
%let ds4=%upcase(work.%mf_getuniquename(prefix=mpsd_keynum));
|
||||||
proc transpose data=&ds2(where=(tgtvar_type='N'))
|
proc transpose data=&ds2(where=(tgtvar_type='N'))
|
||||||
out=&ds4(drop=_name_);
|
out=&ds4(drop=_name_);
|
||||||
by KEY_HASH;
|
by KEY_HASH PROCESSED_DTTM;
|
||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var numval;
|
var numval;
|
||||||
run;
|
run;
|
||||||
@@ -13523,6 +13523,7 @@ run;
|
|||||||
|
|
||||||
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
|
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
|
||||||
data &ds5;
|
data &ds5;
|
||||||
|
length key_hash $32 processed_dttm 8;
|
||||||
merge &ds3 &ds4;
|
merge &ds3 &ds4;
|
||||||
by key_hash;
|
by key_hash;
|
||||||
if not missing(key_hash);
|
if not missing(key_hash);
|
||||||
@@ -13530,7 +13531,7 @@ run;
|
|||||||
|
|
||||||
/* join to base table for preliminary stage DS */
|
/* join to base table for preliminary stage DS */
|
||||||
proc sql;
|
proc sql;
|
||||||
create table &outds as select "No " as _____DELETE_THIS_RECORD_____,
|
create table &outds as select "No " as _____DELETE__THIS__RECORD_____,
|
||||||
b.*
|
b.*
|
||||||
from &ds5 a
|
from &ds5 a
|
||||||
inner join &libds b
|
inner join &libds b
|
||||||
@@ -13567,7 +13568,7 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
else if move_type='A' then do;
|
else if move_type='A' then do;
|
||||||
if first.key_hash then do;
|
if first.key_hash then do;
|
||||||
put "update &outds set _____DELETE_THIS_RECORD_____='Yes' where 1=1 " @@;
|
put "update &outds set _____DELETE__THIS__RECORD_____='Yes' where 1=1 "@@;
|
||||||
end;
|
end;
|
||||||
/* gating if - as only need PK now */
|
/* gating if - as only need PK now */
|
||||||
if is_pk=1;
|
if is_pk=1;
|
||||||
@@ -13578,7 +13579,7 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
else if move_type='D' then do;
|
else if move_type='D' then do;
|
||||||
if first.key_hash then do;
|
if first.key_hash then do;
|
||||||
put "insert into &outds set _____DELETE_THIS_RECORD_____='No' " @@;
|
put "insert into &outds set _____DELETE__THIS__RECORD_____='No' " @@;
|
||||||
end;
|
end;
|
||||||
put " ," tgtvar_nm '=' @@;
|
put " ," tgtvar_nm '=' @@;
|
||||||
charval=quote(cats(oldval_char));
|
charval=quote(cats(oldval_char));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
@li deleted rows - these are re-inserted
|
@li deleted rows - these are re-inserted
|
||||||
@li changed rows - differences are reverted
|
@li changed rows - differences are reverted
|
||||||
@li added rows - these are marked with `_____DELETE_THIS_RECORD_____="YES"`
|
@li added rows - marked with `_____DELETE__THIS__RECORD_____="YES"`
|
||||||
|
|
||||||
These changes are NOT applied to the base table - a staging dataset is
|
These changes are NOT applied to the base table - a staging dataset is
|
||||||
simply prepared for an ETL process to action. In Data Controller, this
|
simply prepared for an ETL process to action. In Data Controller, this
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
in mddl_dc_difftable.sas
|
in mddl_dc_difftable.sas
|
||||||
@param [out] outds= (work.mp_stripdiffs) Output table containing the diffs.
|
@param [out] outds= (work.mp_stripdiffs) Output table containing the diffs.
|
||||||
Has the same format as the base datset, plus a
|
Has the same format as the base datset, plus a
|
||||||
`_____DELETE_THIS_RECORD_____` variable.
|
`_____DELETE__THIS__RECORD_____` variable.
|
||||||
@param [in] mdebug= set to 1 to enable DEBUG messages and preserve outputs
|
@param [in] mdebug= set to 1 to enable DEBUG messages and preserve outputs
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@@ -120,7 +120,7 @@ run;
|
|||||||
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
|
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
|
||||||
proc transpose data=&ds2(where=(tgtvar_type='C'))
|
proc transpose data=&ds2(where=(tgtvar_type='C'))
|
||||||
out=&ds3(drop=_name_);
|
out=&ds3(drop=_name_);
|
||||||
by KEY_HASH;
|
by KEY_HASH PROCESSED_DTTM;
|
||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var charval;
|
var charval;
|
||||||
run;
|
run;
|
||||||
@@ -128,7 +128,7 @@ run;
|
|||||||
%let ds4=%upcase(work.%mf_getuniquename(prefix=mpsd_keynum));
|
%let ds4=%upcase(work.%mf_getuniquename(prefix=mpsd_keynum));
|
||||||
proc transpose data=&ds2(where=(tgtvar_type='N'))
|
proc transpose data=&ds2(where=(tgtvar_type='N'))
|
||||||
out=&ds4(drop=_name_);
|
out=&ds4(drop=_name_);
|
||||||
by KEY_HASH;
|
by KEY_HASH PROCESSED_DTTM;
|
||||||
id TGTVAR_NM;
|
id TGTVAR_NM;
|
||||||
var numval;
|
var numval;
|
||||||
run;
|
run;
|
||||||
@@ -138,6 +138,7 @@ run;
|
|||||||
|
|
||||||
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
|
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
|
||||||
data &ds5;
|
data &ds5;
|
||||||
|
length key_hash $32 processed_dttm 8;
|
||||||
merge &ds3 &ds4;
|
merge &ds3 &ds4;
|
||||||
by key_hash;
|
by key_hash;
|
||||||
if not missing(key_hash);
|
if not missing(key_hash);
|
||||||
@@ -145,7 +146,7 @@ run;
|
|||||||
|
|
||||||
/* join to base table for preliminary stage DS */
|
/* join to base table for preliminary stage DS */
|
||||||
proc sql;
|
proc sql;
|
||||||
create table &outds as select "No " as _____DELETE_THIS_RECORD_____,
|
create table &outds as select "No " as _____DELETE__THIS__RECORD_____,
|
||||||
b.*
|
b.*
|
||||||
from &ds5 a
|
from &ds5 a
|
||||||
inner join &libds b
|
inner join &libds b
|
||||||
@@ -182,7 +183,7 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
else if move_type='A' then do;
|
else if move_type='A' then do;
|
||||||
if first.key_hash then do;
|
if first.key_hash then do;
|
||||||
put "update &outds set _____DELETE_THIS_RECORD_____='Yes' where 1=1 " @@;
|
put "update &outds set _____DELETE__THIS__RECORD_____='Yes' where 1=1 "@@;
|
||||||
end;
|
end;
|
||||||
/* gating if - as only need PK now */
|
/* gating if - as only need PK now */
|
||||||
if is_pk=1;
|
if is_pk=1;
|
||||||
@@ -193,7 +194,7 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
else if move_type='D' then do;
|
else if move_type='D' then do;
|
||||||
if first.key_hash then do;
|
if first.key_hash then do;
|
||||||
put "insert into &outds set _____DELETE_THIS_RECORD_____='No' " @@;
|
put "insert into &outds set _____DELETE__THIS__RECORD_____='No' " @@;
|
||||||
end;
|
end;
|
||||||
put " ," tgtvar_nm '=' @@;
|
put " ," tgtvar_nm '=' @@;
|
||||||
charval=quote(cats(oldval_char));
|
charval=quote(cats(oldval_char));
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ run;
|
|||||||
%let addpass=0;
|
%let addpass=0;
|
||||||
data _null_;
|
data _null_;
|
||||||
set work.mp_stripdiffs;
|
set work.mp_stripdiffs;
|
||||||
if upcase(_____DELETE_THIS_RECORD_____)='NO' and name="&delname"
|
if upcase(_____DELETE__THIS__RECORD_____)='NO' and name="&delname"
|
||||||
then call symputx('delpass',1);
|
then call symputx('delpass',1);
|
||||||
if name="&modname" and age=&modval then call symputx('modpass',1);
|
if name="&modname" and age=&modval then call symputx('modpass',1);
|
||||||
if upcase(_____DELETE_THIS_RECORD_____)='YES' and name="Newbie"
|
if upcase(_____DELETE__THIS__RECORD_____)='YES' and name="Newbie"
|
||||||
then call symputx('addpass',1);
|
then call symputx('addpass',1);
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user