@sasjs/core 6.1.3 → 7.0.0

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.
package/.sasjslint CHANGED
@@ -7,7 +7,9 @@
7
7
  "lineEndings": "lf",
8
8
  "noGremlins": true,
9
9
  "noNestedMacros": true,
10
+ "noSingleAsteriskComments": true,
10
11
  "noSpacesInFileNames": true,
12
+ "noUnusedLibnames": true,
11
13
  "maxLineLength": 80,
12
14
  "lowerCaseFileNames": true,
13
15
  "noTabs": true,
@@ -21,19 +23,19 @@
21
23
  "lowerCaseFileNames": "error",
22
24
  "maxLineLength": "error",
23
25
  "minMacroNameLength": "error",
26
+ "noBannedStrings": "error",
24
27
  "noEncodedPasswords": "error",
25
28
  "noGremlins": "error",
26
29
  "noNestedCommentsInHeader": "error",
30
+ "noNestedMacros": "error",
31
+ "noSingleAsteriskComments": "error",
27
32
  "noSpacesInFileNames": "error",
28
33
  "noTabs": "error",
29
34
  "noTrailingSpaces": "error",
30
35
  "noUndeclaredMacros": "error",
31
- "noUnusedMacros": "error",
32
- "strictMacroDefinition": "error",
33
- "noBannedStrings": "error",
34
- "noSingleAsteriskComments": "error",
35
36
  "noUnusedLibnames": "error",
36
- "hasRequiredMacroOptions": "error"
37
+ "noUnusedMacros": "error",
38
+ "strictMacroDefinition": "error"
37
39
  },
38
40
  "ignoreList": [
39
41
  "all.sas"
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  @file
3
3
  @brief Checks if a set of variables ALL exist in a data set.
4
- @details Returns 0 if ANY of the variables do not exist, or 1 if they ALL do.
4
+ @details Returns 0 if ANY of the variables do not exist, if the dataset
5
+ cannot be opened, if it holds no variables, or if `libds` / `varlist` is
6
+ blank. Returns 1 if they ALL exist. The macro never aborts: a blank input
7
+ answers 0 and the calling program decides whether that is a condition to
8
+ stop on (`mp_abort`) or simply a negative result.
5
9
  Usage:
6
10
 
7
11
  %put %mf_existVarList(sashelp.class, age sex name dummyvar);
@@ -9,9 +13,6 @@
9
13
  @param [in] libds 2 part dataset or view reference
10
14
  @param [in] varlist space separated variable names
11
15
 
12
- <h4> SAS Macros </h4>
13
- @li mf_abort.sas
14
-
15
16
  @version 9.2
16
17
  @author Allan Bowe
17
18
  @cond
@@ -20,9 +21,12 @@
20
21
  %macro mf_existvarlist(libds, varlist
21
22
  )/*/STORE SOURCE*/;
22
23
 
24
+ /* nothing to check - answer 0 and let the caller decide whether a blank
25
+ input is a condition worth stopping on */
23
26
  %if %str(&libds)=%str() or %str(&varlist)=%str() %then %do;
24
- %mf_abort(msg=No value provided to libds(&libds) or varlist (&varlist)!
25
- ,mac=mf_existvarlist.sas)
27
+ %put %str(WARN)ING: blank libds/varlist in mf_existvarlist;
28
+ 0
29
+ %return;
26
30
  %end;
27
31
 
28
32
  %local dsid rc i var found;
@@ -30,10 +34,16 @@
30
34
 
31
35
  %if &dsid=0 %then %do;
32
36
  %put %str(WARN)ING: unable to open &libds in mf_existvarlist (&dsid);
37
+ /* the failed open reports through SYSMSG, not SYSERR or SYSCC, so the
38
+ return value is the whole signal - and ATTRN and VARNUM return a missing
39
+ value for dsid 0, which would report a match, so return before probing */
40
+ 0
41
+ %return;
33
42
  %end;
34
43
 
35
44
  %if %sysfunc(attrn(&dsid,NVARS))=0 %then %do;
36
45
  %put MF_EXISTVARLIST: No variables in &libds ;
46
+ %let rc=%sysfunc(close(&dsid));
37
47
  0
38
48
  %return;
39
49
  %end;
@@ -182,7 +182,7 @@ run;
182
182
  /* Create Unique Indexes, but only if they were not already defined within
183
183
  the Constraints section. */
184
184
  data _null_;
185
- *length ds $128;
185
+ /*length ds $128;*/
186
186
  set &idxinfo(
187
187
  where=(
188
188
  memname="&curds"
@@ -200,7 +200,7 @@ run;
200
200
  put ' ' name ;
201
201
  end;
202
202
  else put ' ,' name ;
203
- *else put ' ,' name ;
203
+ /*else put ' ,' name;*/
204
204
  if last.indxname then do;
205
205
  put ');';
206
206
  end;
@@ -259,7 +259,7 @@ run;
259
259
  /* Create Unique Indexes, but only if they were not already defined within
260
260
  the Constraints section. */
261
261
  data _null_;
262
- *length ds $128;
262
+ /*length ds $128;*/
263
263
  set &idxinfo(
264
264
  where=(
265
265
  memname="&curds"
@@ -271,7 +271,7 @@ run;
271
271
  );
272
272
  file &fref mod;
273
273
  by idxusage indxname;
274
- *ds=cats(libname,'.',memname);
274
+ /*ds=cats(libname,'.',memname);*/
275
275
  if first.indxname then do;
276
276
  /* add nonclustered in case of multiple unique indexes */
277
277
  put ' ,index [' indxname +(-1) '] UNIQUE NONCLUSTERED (';
@@ -372,7 +372,7 @@ run;
372
372
  /* Create Unique Indexes, but only if they were not already defined within
373
373
  the Constraints section. */
374
374
  data _null_;
375
- *length ds $128;
375
+ /*length ds $128;*/
376
376
  set &idxinfo(
377
377
  where=(
378
378
  memname="&curds"
@@ -83,7 +83,7 @@ data &outds (keep=ods_table name value);
83
83
  value cvalue cvalue1 cvalue2 $1000
84
84
  nvalue nvalue1 nvalue2 8;
85
85
  if _n_=1 then call missing (of _all_);
86
- * putlog (_all_)(=);
86
+ /*putlog (_all_)(=);*/
87
87
  set &ds1 (in=atrs) &ds2 (in=eng);
88
88
  if atrs then do;
89
89
  ods_table='ATTRIBUTES';
@@ -46,42 +46,42 @@ data _null_;
46
46
  call missing (of _all_);
47
47
  folderPath = "%trim(&path)";
48
48
 
49
- * remove any trailing slash ;
49
+ /* remove any trailing slash */
50
50
  if ( substr(folderPath,length(folderPath),1) = '/' ) then
51
51
  folderPath=substr(folderPath,1,length(folderPath)-1);
52
52
 
53
- * name must not be blank;
53
+ /* name must not be blank */
54
54
  if ( folderPath = '' ) then do;
55
55
  put 'ERR' +(-1) "OR: &sysmacroname PATH parameter value must be non-blank";
56
56
  end;
57
57
 
58
- * must have a starting slash ;
58
+ /* must have a starting slash */
59
59
  if ( substr(folderPath,1,1) ne '/' ) then do;
60
60
  put 'ERR' +(-1) "OR: &sysmacroname PATH param value must have starting slash";
61
61
  stop;
62
62
  end;
63
63
 
64
- * check if folder already exists ;
64
+ /* check if folder already exists */
65
65
  rc=metadata_pathobj('',cats(folderPath,"(Folder)"),"",objType,objId);
66
66
  if rc ge 1 then do;
67
67
  put "NOTE: Folder " folderPath " already exists!";
68
68
  stop;
69
69
  end;
70
70
 
71
- * do not create a root (one level) folder ;
71
+ /* do not create a root (one level) folder */
72
72
  if countc(folderPath,'/')=1 then do;
73
73
  put 'ERR' +(-1) "OR: &sysmacroname will not create a new ROOT folder";
74
74
  stop;
75
75
  end;
76
76
 
77
- * check that root folder exists ;
77
+ /* check that root folder exists */
78
78
  root=cats('/',scan(folderpath,1,'/'),"(Folder)");
79
79
  if metadata_pathobj('',root,"",objType,parentId)<1 then do;
80
80
  put 'ERR' +(-1) "OR: " root " does not exist!";
81
81
  stop;
82
82
  end;
83
83
 
84
- * check that parent folder exists ;
84
+ /* check that parent folder exists */
85
85
  child=scan(folderPath,-1,'/');
86
86
  parent=substr(folderpath,1,length(folderpath)-length(child)-1);
87
87
  rc=metadata_pathobj('',cats(parent,"(Folder)"),"",objType,parentId);
@@ -81,7 +81,7 @@ Usage:
81
81
  %&mD.put Executing mm_createwebservice.sas;
82
82
  %&mD.put _local_;
83
83
 
84
- * remove any trailing slash ;
84
+ /* remove any trailing slash */
85
85
  %if "%substr(&path,%length(&path),1)" = "/" %then
86
86
  %let path=%substr(&path,1,%length(&path)-1);
87
87
 
@@ -44,18 +44,18 @@
44
44
  drop uriGrp uriMem rcGrp rcMem rc i j arc ;
45
45
 
46
46
  i=1;
47
- * Grab the URI for the first Group ;
47
+ /* Grab the URI for the first Group */
48
48
  %if &id=NO %then %do;
49
49
  rcGrp=metadata_getnobj("omsobj:IdentityGroup?@Name='&group'",i,uriGrp);
50
50
  %end;
51
51
  %else %do;
52
52
  rcGrp=metadata_getnobj("omsobj:IdentityGroup?@Id='&group'",i,uriGrp);
53
53
  %end;
54
- * If Group found, enter do loop ;
54
+ /* If Group found, enter do loop */
55
55
  if rcGrp>0 then do;
56
56
  call missing (rcMem,uriMem,GroupId,GroupName,Group_or_Role
57
57
  ,MemberName,MemberType);
58
- * get group info ;
58
+ /* get group info */
59
59
  rc = metadata_getattr(uriGrp,"Id",GroupId);
60
60
  rc = metadata_getattr(uriGrp,"Name",GroupName);
61
61
  rc = metadata_getattr(uriGrp,"PublicType",Group_or_Role);
@@ -42,7 +42,7 @@ data _null_;
42
42
  call symputx('flags',flags,'l');
43
43
  run;
44
44
 
45
- * use a temporary fileref to hold the response;
45
+ /* use a temporary fileref to hold the response */
46
46
  filename response temp;
47
47
  /* get list of libraries */
48
48
  proc metadata in=
@@ -23,7 +23,7 @@
23
23
  ,outds=work.mm_getobjects
24
24
  )/*/STORE SOURCE*/;
25
25
 
26
- * use a temporary fileref to hold the response;
26
+ /* use a temporary fileref to hold the response */
27
27
  filename response temp;
28
28
  /* get list of libraries */
29
29
  proc metadata in=
@@ -22,7 +22,7 @@
22
22
  outds=work.mm_getrepos
23
23
  )/*/STORE SOURCE*/;
24
24
 
25
- * use a temporary fileref to hold the response;
25
+ /* use a temporary fileref to hold the response */
26
26
  filename response temp;
27
27
  /* get list of libraries */
28
28
  proc metadata in=
@@ -95,7 +95,7 @@ data _null_;
95
95
  start=index(_infile_,'StoredText="');
96
96
  if start then do;
97
97
  call symputx("start",start+11);
98
- *putlog '"' _infile_ '"';
98
+ /*putlog '"' _infile_ '"';*/
99
99
  end;
100
100
  stop;
101
101
 
@@ -23,7 +23,7 @@
23
23
  outds=work.mm_gettypes
24
24
  )/*/STORE SOURCE*/;
25
25
 
26
- * use a temporary fileref to hold the response;
26
+ /* use a temporary fileref to hold the response */
27
27
  filename response temp;
28
28
  /* get list of libraries */
29
29
  proc metadata in=
package/meta/mm_tree.sas CHANGED
@@ -81,7 +81,7 @@ options noquotelenmax;
81
81
  drop table &tempds;
82
82
  %end;
83
83
 
84
- * use a temporary fileref to hold the response;
84
+ /* use a temporary fileref to hold the response */
85
85
  filename response temp;
86
86
  /* get list of libraries */
87
87
  proc metadata in=
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "@nogoo9/gitleaks": "8.30.1-post.2"
45
45
  },
46
- "version": "6.1.3"
46
+ "version": "7.0.0"
47
47
  }
@@ -110,7 +110,7 @@ https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5p
110
110
 
111
111
  options noquotelenmax;
112
112
 
113
- * remove any trailing slash ;
113
+ /* remove any trailing slash */
114
114
  %if "%substr(&path,%length(&path),1)" = "/" %then
115
115
  %let path=%substr(&path,1,%length(&path)-1);
116
116
 
@@ -118,7 +118,7 @@ https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5p
118
118
 
119
119
  options noquotelenmax;
120
120
 
121
- * remove any trailing slash ;
121
+ /* remove any trailing slash */
122
122
  %if "%substr(&path,%length(&path),1)" = "/" %then
123
123
  %let path=%substr(&path,1,%length(&path)-1);
124
124