@sasjs/core 4.51.3 → 4.51.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,7 +98,7 @@ create table &ds1 (drop=libref dsn) as
98
98
  /* extract key values only */
99
99
  %let ds2=%upcase(work.%mf_getuniquename(prefix=mpsd_pks));
100
100
  create table &ds2 as
101
- select key_hash,
101
+ select distinct key_hash,
102
102
  tgtvar_nm,
103
103
  tgtvar_type,
104
104
  coalescec(oldval_char,newval_char) as charval,
@@ -112,9 +112,9 @@ create table &ds2 as
112
112
  %local pk;
113
113
  data _null_;
114
114
  set &ds2;
115
- by key_hash;
115
+ by key_hash processed_dttm;
116
116
  call symputx('pk',catx(' ',symget('pk'),tgtvar_nm),'l');
117
- if last.key_hash then stop;
117
+ if last.processed_dttm then stop;
118
118
  run;
119
119
 
120
120
  %let ds3=%upcase(work.%mf_getuniquename(prefix=mpsd_keychar));
@@ -136,6 +136,7 @@ run;
136
136
  %mp_ds2squeeze(&ds3,outds=&ds3)
137
137
  %mp_ds2squeeze(&ds4,outds=&ds4)
138
138
 
139
+ /* now merge to get all key values and de-dup */
139
140
  %let ds5=%upcase(work.%mf_getuniquename(prefix=mpsd_merged));
140
141
  data &ds5;
141
142
  length key_hash $32 processed_dttm 8;
@@ -143,6 +144,9 @@ data &ds5;
143
144
  by key_hash;
144
145
  if not missing(key_hash);
145
146
  run;
147
+ proc sort data=&ds5 nodupkey;
148
+ by &pk;
149
+ run;
146
150
 
147
151
  /* join to base table for preliminary stage DS */
148
152
  proc sql;
@@ -159,7 +163,8 @@ create table &outds as select "No " as _____DELETE__THIS__RECORD_____,
159
163
  /* create SAS code to apply to stage_ds */
160
164
  data _null_;
161
165
  set &ds1;
162
- file &fref1;
166
+ file &fref1 lrecl=33000;
167
+ length charval $32767;
163
168
  if _n_=1 then put 'proc sql noprint;';
164
169
  by descending processed_dttm key_hash is_pk;
165
170
  if move_type='M' then do;
@@ -168,7 +173,8 @@ data _null_;
168
173
  end;
169
174
  if IS_PK=0 then do;
170
175
  put " " tgtvar_nm '=' @@;
171
- charval=quote(cats(oldval_char));
176
+ cnt=count(oldval_char,'"');
177
+ charval=quote(trim(substr(oldval_char,1,32765-cnt)));
172
178
  if tgtvar_type='C' then put charval @@;
173
179
  else put oldval_num @@;
174
180
  if not last.is_pk then put ',';
@@ -176,7 +182,8 @@ data _null_;
176
182
  else do;
177
183
  if first.is_pk then put " where 1=1 " @@;
178
184
  put " and " tgtvar_nm '=' @@;
179
- charval=quote(cats(oldval_char));
185
+ cnt=count(oldval_char,'"');
186
+ charval=quote(trim(substr(oldval_char,1,32765-cnt)));
180
187
  if tgtvar_type='C' then put charval @@;
181
188
  else put oldval_num @@;
182
189
  end;
@@ -188,7 +195,8 @@ data _null_;
188
195
  /* gating if - as only need PK now */
189
196
  if is_pk=1;
190
197
  put ' AND ' tgtvar_nm '=' @@;
191
- charval=quote(cats(newval_char));
198
+ cnt=count(newval_char,'"');
199
+ charval=quote(trim(substr(newval_char,1,32765-cnt)));
192
200
  if tgtvar_type='C' then put charval @@;
193
201
  else put newval_num @@;
194
202
  end;
@@ -197,7 +205,8 @@ data _null_;
197
205
  put "insert into &outds set _____DELETE__THIS__RECORD_____='No' " @@;
198
206
  end;
199
207
  put " ," tgtvar_nm '=' @@;
200
- charval=quote(cats(oldval_char));
208
+ cnt=count(oldval_char,'"');
209
+ charval=quote(trim(substr(oldval_char,1,32765-cnt)));
201
210
  if tgtvar_type='C' then put charval @@;
202
211
  else put oldval_num @@;
203
212
  end;
@@ -205,7 +214,7 @@ data _null_;
205
214
  run;
206
215
 
207
216
  /* apply the modification statements */
208
- %inc &fref1/source2;
217
+ %inc &fref1/source2 lrecl=33000;
209
218
 
210
219
  %if &mdebug=0 %then %do;
211
220
  proc sql;
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "^4.4.1"
37
37
  },
38
- "version": "4.51.3"
38
+ "version": "4.51.5"
39
39
  }