@sasjs/core 4.32.11 → 4.32.14

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.
@@ -31,6 +31,7 @@
31
31
  @param [in] mode (CREATE) Valid values:
32
32
  @li CREATE - Create the file (even if it already exists)
33
33
  @li APPEND - Append to the file (don't overwrite)
34
+ @param iftrue= (1=1) Supply a condition for which the macro should be executed
34
35
 
35
36
  @returns nothing
36
37
 
@@ -44,8 +45,12 @@
44
45
  ,inref=____in /* override default to use own filerefs */
45
46
  ,outref=____out /* override default to use own filerefs */
46
47
  ,mode=CREATE
48
+ ,iftrue=%str(1=1)
47
49
  )/*/STORE SOURCE*/;
48
50
  %local mod;
51
+
52
+ %if not(%eval(%unquote(&iftrue))) %then %return;
53
+
49
54
  %if &mode=APPEND %then %let mod=mod;
50
55
 
51
56
  /* these IN and OUT filerefs can point to anything */
@@ -92,7 +92,8 @@ data &outds;
92
92
  /*length GROUP_LOGIC SUBGROUP_LOGIC $3 SUBGROUP_ID 8 VARIABLE_NM $32
93
93
  OPERATOR_NM $10 RAW_VALUE $4000;*/
94
94
  set &inds;
95
- length reason_cd $4032 vtype $1 vnum dsid 8;
95
+ length reason_cd $4032 vtype $1 vnum dsid 8 tmp $4000;
96
+ drop tmp;
96
97
 
97
98
  /* quick check to ensure column exists */
98
99
  if upcase(VARIABLE_NM) not in
@@ -168,18 +169,32 @@ data &outds;
168
169
  end;
169
170
 
170
171
  /* special logic */
171
- if OPERATOR_NM='BETWEEN' then raw_value1=tranwrd(raw_value,' AND ','');
172
- else if OPERATOR_NM in ('IN','NOT IN') then do;
173
- if substr(raw_value,1,1) ne '('
174
- or substr(cats(reverse(raw_value)),1,1) ne ')'
175
- then do;
176
- REASON_CD='Missing start/end bracket in RAW_VALUE';
177
- putlog REASON_CD= OPERATOR_NM= raw_value= raw_value1= ;
178
- call symputx('reason_cd',reason_cd,'l');
179
- call symputx('nobs',_n_,'l');
180
- output;
172
+ if OPERATOR_NM in ('IN','NOT IN','BETWEEN') then do;
173
+ if OPERATOR_NM='BETWEEN' then raw_value1=tranwrd(raw_value,' AND ',',');
174
+ else do;
175
+ if substr(raw_value,1,1) ne '('
176
+ or substr(cats(reverse(raw_value)),1,1) ne ')'
177
+ then do;
178
+ REASON_CD='Missing start/end bracket in RAW_VALUE';
179
+ putlog REASON_CD= OPERATOR_NM= raw_value= raw_value1= ;
180
+ call symputx('reason_cd',reason_cd,'l');
181
+ call symputx('nobs',_n_,'l');
182
+ output;
183
+ end;
184
+ else raw_value1=substr(raw_value,2,max(length(raw_value)-2,0));
185
+ end;
186
+ /* we now have a comma seperated list of values */
187
+ if vtype='N' then do i=1 to countc(raw_value1, ',')+1;
188
+ tmp=scan(raw_value1,i,',');
189
+ if cats(tmp) ne '.' and input(tmp, ?? 8.) eq . then do;
190
+ REASON_CD='Non Numeric value provided';
191
+ putlog REASON_CD= OPERATOR_NM= raw_value= raw_value1= ;
192
+ call symputx('reason_cd',reason_cd,'l');
193
+ call symputx('nobs',_n_,'l');
194
+ output;
195
+ end;
196
+ return;
181
197
  end;
182
- else raw_value1=substr(raw_value,2,max(length(raw_value)-2,0));
183
198
  end;
184
199
  else raw_value1=raw_value;
185
200
 
@@ -154,7 +154,9 @@ run;
154
154
  %else %let vlist=%mf_getvarlist(&libds,dlm=%str(,),quote=DOUBLE);
155
155
 
156
156
  data &ds4;
157
- length &inds_keep $41 tgtvar_nm $32;
157
+ length &inds_keep $41 tgtvar_nm $32 _label_ $256;
158
+ if _n_=1 then call missing(_label_);
159
+ drop _label_;
158
160
  set &ds2 &ds3 indsname=&inds_auto;
159
161
 
160
162
  tgtvar_nm=upcase(tgtvar_nm);
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.32.11"
38
+ "version": "4.32.14"
39
39
  }