@sasjs/core 5.3.0 → 5.3.2

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.
@@ -29,26 +29,26 @@
29
29
 
30
30
  %macro mf_getvalue(libds,variable,filter=1,fetchobs=1,warn=0
31
31
  )/*/STORE SOURCE*/;
32
- %local dsid rc vartype;
32
+ %local dsid rc vartype result;
33
33
 
34
34
  %let vartype = %mf_getvartype(&libds,&variable);
35
35
 
36
36
  %let dsid=%sysfunc(open(&libds(where=(&filter))));
37
37
  %if (&dsid) %then %do;
38
- %syscall set(dsid);
39
38
  %let rc = %sysfunc(fetchobs(&dsid,&fetchobs));
40
39
  %if (&rc ne 0) %then %do;
41
- %put %sysfunc(sysmsg());
42
- /* Set the requested variable to a missing value */
43
- /* Need only consider numerics - char variables are already empty*/
44
- %if (&vartype eq N) %then %let &variable = .;
40
+ /* Fetchobs() failed - Log any issue that was not 'read past end' */
41
+ %if (&rc ne -1) %then %put %sysfunc(sysmsg());
42
+ /* Set the result to a missing value dependent on type. */
43
+ %if (&vartype eq N) %then %let result = .;
44
+ %else %let result = ;
45
+
45
46
  %if (&warn) %then %do;
46
47
  %if (&rc eq -1) %then %do; /* read past end of data */
47
48
  %put %sysfunc(
48
49
  compbl(
49
- %quote(WARN%str(ING): Missing value returned as no rows were)
50
- %quote(found in &libds for filter (%superq(filter)))
51
- %quote(and/or fetchobs (&fetchobs).)
50
+ %quote(WARN%str(ING): Missing value returned for variable)
51
+ %quote(&variable after reading past end of &libds..)
52
52
  )
53
53
  );
54
54
  %let rc=4;
@@ -57,9 +57,17 @@
57
57
  /* And update SYSCC if the &rc value is higher */
58
58
  %let syscc = %sysfunc(max(&syscc,&rc));
59
59
  %end;
60
+ %else %do;
61
+ %let result = %sysfunc(
62
+ getvar&vartype(
63
+ &dsid
64
+ ,%sysfunc(varnum(&dsid,&variable))
65
+ )
66
+ );
67
+ %end;
60
68
  %let rc = %sysfunc(close(&dsid));
61
69
 
62
- %trim(&&&variable)
70
+ %trim(&result)
63
71
 
64
72
  %end;
65
73
  %else %do;
@@ -150,7 +150,7 @@
150
150
  run;
151
151
 
152
152
  %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
153
- proc sql;
153
+ proc sql noprint;
154
154
  select count(*) into: lastobs from &ds;
155
155
  %if &maxobs ne MAX %then %let lastobs=%sysfunc(min(&lastobs,&maxobs));
156
156
 
@@ -174,7 +174,7 @@ data _null_;
174
174
  put ' run; ';
175
175
  put ' ';
176
176
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
177
- put ' proc sql; ';
177
+ put ' proc sql noprint; ';
178
178
  put ' select count(*) into: lastobs from &ds; ';
179
179
  put ' %if &maxobs ne MAX %then %let lastobs=%sysfunc(min(&lastobs,&maxobs)); ';
180
180
  put ' ';
package/package.json CHANGED
@@ -35,8 +35,7 @@
35
35
  "build": "npx @sasjs/cli cbd -t server",
36
36
  "docs": "npx @sasjs/cli doc -t docsonly && ./sasjs/utils/build.sh",
37
37
  "test": "npx @sasjs/cli test -t server",
38
- "lint": "npx @sasjs/cli lint",
39
- "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
38
+ "lint": "npx @sasjs/cli lint"
40
39
  },
41
40
  "maintainers": [
42
41
  "https://sasapps.io"
@@ -44,5 +43,5 @@
44
43
  "devDependencies": {
45
44
  "@nogoo9/gitleaks": "8.30.1-post.2"
46
45
  },
47
- "version": "5.3.0"
46
+ "version": "5.3.2"
48
47
  }
@@ -174,7 +174,7 @@ data _null_;
174
174
  put ' run; ';
175
175
  put ' ';
176
176
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
177
- put ' proc sql; ';
177
+ put ' proc sql noprint; ';
178
178
  put ' select count(*) into: lastobs from &ds; ';
179
179
  put ' %if &maxobs ne MAX %then %let lastobs=%sysfunc(min(&lastobs,&maxobs)); ';
180
180
  put ' ';
@@ -160,7 +160,7 @@ filename &outref "&resp_path" lrecl=32767;
160
160
 
161
161
  /* prepare request*/
162
162
  proc http method='POST' headerin=&authref in=&mainref out=&outref
163
- url="&_sasjs_apiserverurl.&_sasjs_apipath?_program=&pgm%str(&)_debug=131";
163
+ url="&_sasjs_apiserverurl.&_sasjs_apipath?_program=&pgm%str(&)_debug=&debug";
164
164
  %if &mdebug=1 %then %do;
165
165
  debug level=2;
166
166
  %end;
@@ -19,7 +19,8 @@
19
19
  |stpmacname|some value|
20
20
  |mustbevalidname|can be anything, oops, %abort!!|
21
21
 
22
- @param [in] debug= (131) Provide the _debug value to pass to the STP
22
+ @param [in] debug= (131) The _debug value to send to the STP. The response
23
+ log is returned when the value is 131 or above, which outlogds depends on.
23
24
  @param [in] mdebug= (0) Set to 1 to provide macro debugging (this macro)
24
25
  @param [out] outlib= (0) Output libref to contain the final tables. Set to
25
26
  0 if the service output is not in JSON format.
@@ -53,7 +54,7 @@
53
54
  inputfiles=0,
54
55
  inputdatasets=0,
55
56
  inputparams=0,
56
- debug=0,
57
+ debug=131,
57
58
  mdebug=0,
58
59
  outlib=0,
59
60
  outref=0,
@@ -95,7 +96,9 @@ data &ds1;
95
96
  run;
96
97
 
97
98
 
98
- /* execute the STP */
99
+ /* execute the STP. _debug is forwarded to ms_runstp, whose own default is
100
+ 131 - the log separator this macro chops on is only present when the
101
+ server runs in debug mode, so outlogds needs the default. */
99
102
  %let fref1=%mf_getuniquefileref();
100
103
 
101
104
  %ms_runstp(&program
@@ -171,7 +171,7 @@
171
171
  /* prepare request*/
172
172
  proc http method='POST' headerin=&authref in=&mainref out=&outref
173
173
  url="&_sasjs_apiserverurl/SASjsApi/stp/trigger?%trim(
174
- )_program=&pgm%str(&)_debug=131%str(&)expiresAfterMins=&expiresaftermins";
174
+ )_program=&pgm%str(&)_debug=&debug%str(&)expiresAfterMins=&expiresaftermins";
175
175
  %if &mdebug=1 %then %do;
176
176
  debug level=2;
177
177
  %end;
@@ -316,7 +316,7 @@ data _null_;
316
316
  put ' run; ';
317
317
  put ' ';
318
318
  put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
319
- put ' proc sql; ';
319
+ put ' proc sql noprint; ';
320
320
  put ' select count(*) into: lastobs from &ds; ';
321
321
  put ' %if &maxobs ne MAX %then %let lastobs=%sysfunc(min(&lastobs,&maxobs)); ';
322
322
  put ' ';