mirror of
https://github.com/sasjs/core.git
synced 2026-01-10 18:50:04 +00:00
feat: adding filtervar option to mp_stripdiffs
This commit is contained in:
11
all.sas
11
all.sas
@@ -13407,6 +13407,8 @@ run;
|
|||||||
change, plus ALL SUBSEQUENT CHANGES, will be reverted in the output table.
|
change, plus ALL SUBSEQUENT CHANGES, will be reverted in the output table.
|
||||||
@param [in] difftable The dataset containing the diffs. Definition available
|
@param [in] difftable The dataset containing the diffs. Definition available
|
||||||
in mddl_dc_difftable.sas
|
in mddl_dc_difftable.sas
|
||||||
|
@param [in] filtervar= (0) If provided, the contents of this macro variable
|
||||||
|
will be applied as an additional filter against &libds
|
||||||
@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.
|
||||||
@@ -13434,6 +13436,7 @@ run;
|
|||||||
%macro mp_stripdiffs(libds
|
%macro mp_stripdiffs(libds
|
||||||
,loadref
|
,loadref
|
||||||
,difftable
|
,difftable
|
||||||
|
,filtervar=0
|
||||||
,outds=work.mp_stripdiffs
|
,outds=work.mp_stripdiffs
|
||||||
,mdebug=0
|
,mdebug=0
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
@@ -13457,11 +13460,11 @@ run;
|
|||||||
,msg=%str(Invalid library.dataset reference - %superq(libds))
|
,msg=%str(Invalid library.dataset reference - %superq(libds))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* set up unique and temporary vars */
|
/* set up unique and temporary vars */
|
||||||
%local ds1 ds2 ds3 ds4 ds5 fref1;
|
%local ds1 ds2 ds3 ds4 ds5 fref1 filterstr;
|
||||||
%let fref1=%mf_getuniquefileref();
|
%let fref1=%mf_getuniquefileref();
|
||||||
|
%if &filtervar ne 0 %then %let filterstr=%superq(&filtervar);
|
||||||
|
%else %let filterstr=%str(1=1);
|
||||||
|
|
||||||
/* get timestamp of the diff to be reverted */
|
/* get timestamp of the diff to be reverted */
|
||||||
%local ts;
|
%local ts;
|
||||||
@@ -13546,7 +13549,7 @@ create table &outds as select "No " as _____DELETE__THIS__RECORD_____
|
|||||||
,b.%scan(¬pkcols,&x,%str( ))
|
,b.%scan(¬pkcols,&x,%str( ))
|
||||||
%end;
|
%end;
|
||||||
from &ds5 a
|
from &ds5 a
|
||||||
left join &libds b
|
left join &libds (where=(&filterstr)) b
|
||||||
on 1=1
|
on 1=1
|
||||||
%do x=1 %to %sysfunc(countw(&pk,%str( )));
|
%do x=1 %to %sysfunc(countw(&pk,%str( )));
|
||||||
and a.%scan(&pk,&x,%str( ))=b.%scan(&pk,&x,%str( ))
|
and a.%scan(&pk,&x,%str( ))=b.%scan(&pk,&x,%str( ))
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
change, plus ALL SUBSEQUENT CHANGES, will be reverted in the output table.
|
change, plus ALL SUBSEQUENT CHANGES, will be reverted in the output table.
|
||||||
@param [in] difftable The dataset containing the diffs. Definition available
|
@param [in] difftable The dataset containing the diffs. Definition available
|
||||||
in mddl_dc_difftable.sas
|
in mddl_dc_difftable.sas
|
||||||
|
@param [in] filtervar= (0) If provided, the contents of this macro variable
|
||||||
|
will be applied as an additional filter against &libds
|
||||||
@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.
|
||||||
@@ -49,6 +51,7 @@
|
|||||||
%macro mp_stripdiffs(libds
|
%macro mp_stripdiffs(libds
|
||||||
,loadref
|
,loadref
|
||||||
,difftable
|
,difftable
|
||||||
|
,filtervar=0
|
||||||
,outds=work.mp_stripdiffs
|
,outds=work.mp_stripdiffs
|
||||||
,mdebug=0
|
,mdebug=0
|
||||||
)/*/STORE SOURCE*/;
|
)/*/STORE SOURCE*/;
|
||||||
@@ -72,11 +75,11 @@
|
|||||||
,msg=%str(Invalid library.dataset reference - %superq(libds))
|
,msg=%str(Invalid library.dataset reference - %superq(libds))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* set up unique and temporary vars */
|
/* set up unique and temporary vars */
|
||||||
%local ds1 ds2 ds3 ds4 ds5 fref1;
|
%local ds1 ds2 ds3 ds4 ds5 fref1 filterstr;
|
||||||
%let fref1=%mf_getuniquefileref();
|
%let fref1=%mf_getuniquefileref();
|
||||||
|
%if &filtervar ne 0 %then %let filterstr=%superq(&filtervar);
|
||||||
|
%else %let filterstr=%str(1=1);
|
||||||
|
|
||||||
/* get timestamp of the diff to be reverted */
|
/* get timestamp of the diff to be reverted */
|
||||||
%local ts;
|
%local ts;
|
||||||
@@ -161,7 +164,7 @@ create table &outds as select "No " as _____DELETE__THIS__RECORD_____
|
|||||||
,b.%scan(¬pkcols,&x,%str( ))
|
,b.%scan(¬pkcols,&x,%str( ))
|
||||||
%end;
|
%end;
|
||||||
from &ds5 a
|
from &ds5 a
|
||||||
left join &libds b
|
left join &libds (where=(&filterstr)) b
|
||||||
on 1=1
|
on 1=1
|
||||||
%do x=1 %to %sysfunc(countw(&pk,%str( )));
|
%do x=1 %to %sysfunc(countw(&pk,%str( )));
|
||||||
and a.%scan(&pk,&x,%str( ))=b.%scan(&pk,&x,%str( ))
|
and a.%scan(&pk,&x,%str( ))=b.%scan(&pk,&x,%str( ))
|
||||||
|
|||||||
Reference in New Issue
Block a user