@sasjs/core 4.37.1 → 4.38.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.
@@ -18,11 +18,14 @@
18
18
  %mp_deleteconstraints(inds=work.constraints,outds=dropped,execute=YES)
19
19
  %mp_createconstraints(inds=work.constraints,outds=created,execute=YES)
20
20
 
21
- @param inds= The input table containing the constraint info
22
- @param outds= a table containing the create statements (create_statement column)
23
- @param execute= `YES|NO` - default is NO. To actually create, use YES.
21
+ @param inds= (work.mp_getconstraints) The input table containing the
22
+ constraint info
23
+ @param outds= (work.mp_createconstraints) A table containing the create
24
+ statements (create_statement column)
25
+ @param execute= (NO) To actually create, use YES.
24
26
 
25
- <h4> SAS Macros </h4>
27
+ <h4> Related Files </h4>
28
+ @li mp_getconstraints.sas
26
29
 
27
30
  @version 9.2
28
31
  @author Allan Bowe
@@ -30,7 +33,7 @@
30
33
  **/
31
34
 
32
35
  %macro mp_createconstraints(inds=mp_getconstraints
33
- ,outds=mp_createconstraints
36
+ ,outds=work.mp_createconstraints
34
37
  ,execute=NO
35
38
  )/*/STORE SOURCE*/;
36
39
 
@@ -64,4 +67,4 @@ data &outds;
64
67
  output;
65
68
  run;
66
69
 
67
- %mend mp_createconstraints;
70
+ %mend mp_createconstraints;
@@ -0,0 +1,50 @@
1
+ /**
2
+ @file mp_dictionary.sas
3
+ @brief Creates a portal (libref) into the SQL Dictionary Views
4
+ @details Provide a libref and the macro will create a series of views against
5
+ each view in the special PROC SQL dictionary libref.
6
+
7
+ This is useful if you would like to visualise (navigate) the views in a SAS
8
+ client such as Base SAS, Enterprise Guide, or Studio (or [Data Controller](
9
+ https://datacontroller.io)).
10
+
11
+ It works by extracting the dictionary.dictionaries view into
12
+ YOURLIB.dictionaries, then uses that to create a YOURLIB.{viewName} for every
13
+ other dictionary.view, eg:
14
+
15
+ proc sql;
16
+ create view YOURLIB.columns as select * from dictionary.columns;
17
+
18
+ Usage:
19
+
20
+ libname demo "/lib/directory";
21
+ %mp_dictionary(lib=demo)
22
+
23
+ Or, to just create them in WORK:
24
+
25
+ %mp_dictionary()
26
+
27
+ If you'd just like to browse the dictionary data model, you can also check
28
+ out [this article](https://rawsas.com/dictionary-of-dictionaries/).
29
+
30
+ @param lib= (WORK) The libref in which to create the views
31
+
32
+ <h4> Related Files </h4>
33
+ @li mp_dictionary.test.sas
34
+
35
+ @version 9.2
36
+ @author Allan Bowe
37
+
38
+ **/
39
+
40
+ %macro mp_dictionary(lib=WORK)/*/STORE SOURCE*/;
41
+ %local list i mem;
42
+ proc sql noprint;
43
+ create view &lib..dictionaries as select * from dictionary.dictionaries;
44
+ select distinct memname into: list separated by ' ' from &lib..dictionaries;
45
+ %do i=1 %to %sysfunc(countw(&list,%str( )));
46
+ %let mem=%scan(&list,&i,%str( ));
47
+ create view &lib..&mem as select * from dictionary.&mem;
48
+ %end;
49
+ quit;
50
+ %mend mp_dictionary;
@@ -58,7 +58,7 @@ data &outds;
58
58
  rc5=metadata_getattr(tsuri,"Name",servercontext);
59
59
  end;
60
60
  else do;
61
- put "%str(ERR)OR: could not find " pgm;
61
+ put "%str(ERR)OR: could not find " path;
62
62
  put (_all_)(=);
63
63
  end;
64
64
  &md.put (_all_)(=);
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.37.1"
38
+ "version": "4.38.0"
39
39
  }
@@ -34,14 +34,25 @@
34
34
 
35
35
  @param path= The full path (on SAS Drive) where the job will be created
36
36
  @param name= The name of the job
37
- @param desc= The description of the job
37
+ @param desc= (Created by the mv_createjob.sas macro) The job description
38
38
  @param precode= Space separated list of filerefs, pointing to the code that
39
39
  needs to be attached to the beginning of the job
40
- @param code= Fileref(s) of the actual code to be added
41
- @param access_token_var= The global macro variable to contain the access token
42
- @param grant_type= valid values are "password" or "authorization_code"
43
- (unquoted). The default is authorization_code.
44
- @param replace= select NO to avoid replacing any existing job in that location
40
+ @param code= (ft15f001) Fileref(s) of the actual code to be added
41
+ @param access_token_var= (ACCESS_TOKEN) Global macro variable containing the
42
+ access token
43
+ @param grant_type= (sas_services) Valid values:
44
+ @li sas_services
45
+ @li detect
46
+ @li authorization_code
47
+ @li password
48
+ @param replace= (YES) select NO to avoid replacing any existing job
49
+ @param addjesbeginendmacros= (false) Relates to the `_addjesbeginendmacros`
50
+ setting. Normally this would always be false however due to a Viya bug
51
+ (https://github.com/sasjs/cli/issues/1229) this is now configurable. Valid
52
+ values:
53
+ @li true
54
+ @li false
55
+ @li 0 - this will prevent the flag from being set (job will default to true)
45
56
  @param contextname= Choose a specific context on which to run the Job. Leave
46
57
  blank to use the default context. From Viya 3.5 it is possible to configure
47
58
  a shared context - see
@@ -62,6 +73,7 @@ https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5p
62
73
  ,replace=YES
63
74
  ,debug=0
64
75
  ,contextname=
76
+ ,addjesbeginendmacros=false
65
77
  );
66
78
  %local oauth_bearer;
67
79
  %if &grant_type=detect %then %do;
@@ -185,19 +197,29 @@ run;
185
197
  %end;
186
198
 
187
199
  /* set up the body of the request to create the service */
188
- %local fname3;
200
+ %local fname3 comma;
189
201
  %let fname3=%mf_getuniquefileref();
190
202
  data _null_;
191
203
  file &fname3 TERMSTR=' ';
192
204
  length string $32767;
193
205
  string=cats('{"version": 0,"name":"'
194
206
  ,"&name"
195
- ,'","type":"Compute","parameters":[{"name":"_addjesbeginendmacros"'
196
- ,',"type":"CHARACTER","defaultValue":"false"}');
207
+ ,'","type":"Compute","parameters":['
208
+ %if &addjesbeginendmacros ne 0 %then %do;
209
+ ,'{"name":"_addjesbeginendmacros"'
210
+ ,',"type":"CHARACTER","defaultValue":"'
211
+ ,"&addjesbeginendmacros"
212
+ ,'"}'
213
+ %let comma=%str(,);
214
+ %end;
215
+ );
197
216
  context=quote(cats(symget('contextname')));
198
217
  if context ne '""' then do;
199
- string=cats(string,',{"version": 1,"name": "_contextName","defaultValue":'
200
- ,context,',"type":"CHARACTER","label":"Context Name","required": false}');
218
+ string=cats(string
219
+ ,"&comma"
220
+ ,'{"version": 1,"name": "_contextName","defaultValue":'
221
+ ,context,',"type":"CHARACTER","label":"Context Name","required": false}'
222
+ );
201
223
  end;
202
224
  string=cats(string,'],"code":"');
203
225
  put string;