Skip to content

Commit e6da373

Browse files
author
^
committed
fix: more dedup fixes on mp_stripdiffs
1 parent ed20bca commit e6da373

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

all.sas

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13483,7 +13483,7 @@ create table &ds1 (drop=libref dsn) as
1348313483
/* extract key values only */
1348413484
%let ds2=%upcase(work.%mf_getuniquename(prefix=mpsd_pks));
1348513485
create table &ds2 as
13486-
select key_hash,
13486+
select distinct key_hash,
1348713487
tgtvar_nm,
1348813488
tgtvar_type,
1348913489
coalescec(oldval_char,newval_char) as charval,
@@ -13497,9 +13497,9 @@ create table &ds2 as
1349713497
%local pk;
1349813498
data _null_;
1349913499
set &ds2;
13500-
by key_hash;
13500+
by key_hash processed_dttm;
1350113501
call symputx('pk',catx(' ',symget('pk'),tgtvar_nm),'l');
13502-
if last.key_hash then stop;
13502+
if last.processed_dttm then stop;
1350313503
run;
1350413504

1350513505
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
@@ -13521,13 +13521,17 @@ run;
1352113521
%mp_ds2squeeze(&ds3,outds=&ds3)
1352213522
%mp_ds2squeeze(&ds4,outds=&ds4)
1352313523

13524+
/* now merge to get all key values and de-dup */
1352413525
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
1352513526
data &ds5;
1352613527
length key_hash $32 processed_dttm 8;
1352713528
merge &ds3 &ds4;
1352813529
by key_hash;
1352913530
if not missing(key_hash);
1353013531
run;
13532+
proc sort data=&ds5 nodupkey;
13533+
by &pk;
13534+
run;
1353113535

1353213536
/* join to base table for preliminary stage DS */
1353313537
proc sql;

base/mp_stripdiffs.sas

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ create table &ds1 (drop=libref dsn) as
9898
/* extract key values only */
9999
%let ds2=%upcase(work.%mf_getuniquename(prefix=mpsd_pks));
100100
create table &ds2 as
101-
select key_hash,
101+
select distinct key_hash,
102102
tgtvar_nm,
103103
tgtvar_type,
104104
coalescec(oldval_char,newval_char) as charval,
@@ -112,9 +112,9 @@ create table &ds2 as
112112
%local pk;
113113
data _null_;
114114
set &ds2;
115-
by key_hash;
115+
by key_hash processed_dttm;
116116
call symputx('pk',catx(' ',symget('pk'),tgtvar_nm),'l');
117-
if last.key_hash then stop;
117+
if last.processed_dttm then stop;
118118
run;
119119

120120
%let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
@@ -136,13 +136,17 @@ run;
136136
%mp_ds2squeeze(&ds3,outds=&ds3)
137137
%mp_ds2squeeze(&ds4,outds=&ds4)
138138

139+
/* now merge to get all key values and de-dup */
139140
%let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
140141
data &ds5;
141142
length key_hash $32 processed_dttm 8;
142143
merge &ds3 &ds4;
143144
by key_hash;
144145
if not missing(key_hash);
145146
run;
147+
proc sort data=&ds5 nodupkey;
148+
by &pk;
149+
run;
146150

147151
/* join to base table for preliminary stage DS */
148152
proc sql;

0 commit comments

Comments
 (0)