@sasjs/core 7.0.0 → 7.0.1

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.
@@ -149,9 +149,15 @@ data _null_;
149
149
  %end;
150
150
  %if &vtype=N %then %do;
151
151
  %if &flavour=SAS %then %do;
152
- put &var;
152
+ /* the value becomes a SQL literal, and PUT writes a special missing
153
+ (.A-.Z, ._) as its letter only - which PROC SQL reads as a column
154
+ name, so the leading period is written first */
155
+ if missing(&var) and &var ne . then put "." &var;
156
+ else put &var;
153
157
  %end;
154
158
  %else %if &flavour=PGSQL %then %do;
159
+ /* Postgres has no special missing values, so any missing numeric
160
+ (including ._ and .A-.Z) is written as NULL */
155
161
  if missing(&var) then put 'NULL';
156
162
  %if &applydttm=YES and "%substr(&vfmt.xxxxxxxx,1,8)"="DATETIME"
157
163
  %then %do;
@@ -575,7 +575,14 @@ select distinct tgtvar_nm into: missvars separated by ' '
575
575
  qstr=quote(trim(NEWVAL_CHAR));
576
576
  put tgtvar_nm '=' qstr;
577
577
  end;
578
- else put tgtvar_nm '=' newval_num;
578
+ else do;
579
+ /* the value becomes a SQL literal, so a special missing (.A-.Z, ._)
580
+ needs its leading period - PUT writes only the letter, which PROC SQL
581
+ reads as a column name */
582
+ put tgtvar_nm '=' @@;
583
+ if missing(newval_num) and newval_num ne . then put "." newval_num;
584
+ else put newval_num;
585
+ end;
579
586
  if comma=' ' then comma=' ,';
580
587
  end;
581
588
  if last.key_hash then put ' where key_hash=trim("' key_hash '");';
@@ -173,6 +173,9 @@ create table &outds as select "No " as _____DELETE__THIS__RECORD_____
173
173
  ;
174
174
 
175
175
  /* create SAS code to apply to stage_ds */
176
+ /* numeric values become SQL literals, so a special missing (.A-.Z, ._) must
177
+ carry its leading period - PUT writes only the letter, which PROC SQL reads
178
+ as a column name */
176
179
  data _null_;
177
180
  set &ds1;
178
181
  file &fref1 lrecl=33000;
@@ -188,6 +191,8 @@ data _null_;
188
191
  cnt=count(oldval_char,'"');
189
192
  charval=quote(trim(substr(oldval_char,1,32765-cnt)));
190
193
  if tgtvar_type='C' then put charval @@;
194
+ else if missing(oldval_num) and oldval_num ne .
195
+ then put "." oldval_num @@;
191
196
  else put oldval_num @@;
192
197
  if not last.is_pk then put ',';
193
198
  end;
@@ -197,6 +202,8 @@ data _null_;
197
202
  cnt=count(oldval_char,'"');
198
203
  charval=quote(trim(substr(oldval_char,1,32765-cnt)));
199
204
  if tgtvar_type='C' then put charval @@;
205
+ else if missing(oldval_num) and oldval_num ne .
206
+ then put "." oldval_num @@;
200
207
  else put oldval_num @@;
201
208
  end;
202
209
  end;
@@ -210,6 +217,8 @@ data _null_;
210
217
  cnt=count(newval_char,'"');
211
218
  charval=quote(trim(substr(newval_char,1,32765-cnt)));
212
219
  if tgtvar_type='C' then put charval @@;
220
+ else if missing(newval_num) and newval_num ne .
221
+ then put "." newval_num @@;
213
222
  else put newval_num @@;
214
223
  end;
215
224
  else if move_type='D' then do;
@@ -221,6 +230,8 @@ data _null_;
221
230
  cnt=count(oldval_char,'"');
222
231
  charval=quote(trim(substr(oldval_char,1,32765-cnt)));
223
232
  if tgtvar_type='C' then put charval @@;
233
+ else if missing(oldval_num) and oldval_num ne .
234
+ then put "." oldval_num @@;
224
235
  else put oldval_num @@;
225
236
  end;
226
237
  else do;
@@ -229,6 +240,8 @@ data _null_;
229
240
  cnt=count(oldval_char,'"');
230
241
  charval=quote(trim(substr(oldval_char,1,32765-cnt)));
231
242
  if tgtvar_type='C' then put charval @@;
243
+ else if missing(oldval_num) and oldval_num ne .
244
+ then put "." oldval_num @@;
232
245
  else put oldval_num @@;
233
246
  end;
234
247
  end;
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "@nogoo9/gitleaks": "8.30.1-post.2"
45
45
  },
46
- "version": "7.0.0"
46
+ "version": "7.0.1"
47
47
  }