@sasjs/core 4.68.3 → 5.1.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/README.md +22 -11
- package/base/mf_getuniquelibref.sas +2 -4
- package/base/mp_abort.sas +1 -1
- package/base/mp_ds2csv.sas +2 -2
- package/base/mp_ds2ddl.sas +388 -24
- package/base/mp_dsmeta.sas +1 -1
- package/base/mp_filterstore.sas +3 -3
- package/base/mp_getmaxvarlengths.sas +1 -1
- package/base/mp_lib2inserts.sas +1 -1
- package/base/mp_retainedkey.sas +4 -4
- package/base/mp_stackdiffs.sas +3 -3
- package/base/mp_storediffs.sas +1 -1
- package/fcmp/mcf_getfmttype.sas +3 -6
- package/fcmp/mcf_length.sas +3 -6
- package/fcmp/mcf_string2file.sas +3 -6
- package/package.json +10 -4
- package/server/ms_testservice.sas +1 -1
- package/xplatform/mx_createfile.sas +127 -0
- package/xplatform/{mx_testservice.sas → mx_execute.sas} +3 -3
- package/base/mp_coretable.sas +0 -73
- package/base/mp_getddl.sas +0 -405
- package/base/mp_testservice.sas +0 -39
package/fcmp/mcf_getfmttype.sas
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Usage:
|
|
18
18
|
|
|
19
|
-
%mcf_getfmttype(
|
|
19
|
+
%mcf_getfmttype()
|
|
20
20
|
|
|
21
21
|
data _null_;
|
|
22
22
|
fmt1=mcf_getfmttype('DATE9.');
|
|
@@ -30,13 +30,11 @@
|
|
|
30
30
|
> fmt1=DATE fmt2=DATETIME
|
|
31
31
|
> fmt3=TIME
|
|
32
32
|
|
|
33
|
-
@param [out] wrap= (
|
|
33
|
+
@param [out] wrap= (YES) Choose NO to omit the proc fcmp wrapper.
|
|
34
34
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
35
35
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
36
36
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
37
37
|
Uses a 3 part format: libref.catalog.package
|
|
38
|
-
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
39
|
-
values inserted only if needed.
|
|
40
38
|
|
|
41
39
|
<h4> SAS Macros </h4>
|
|
42
40
|
@li mcf_init.sas
|
|
@@ -50,8 +48,7 @@
|
|
|
50
48
|
|
|
51
49
|
**/
|
|
52
50
|
|
|
53
|
-
%macro mcf_getfmttype(wrap=
|
|
54
|
-
,insert_cmplib=DEPRECATED
|
|
51
|
+
%macro mcf_getfmttype(wrap=YES
|
|
55
52
|
,lib=WORK
|
|
56
53
|
,cat=SASJS
|
|
57
54
|
,pkg=UTILS
|
package/fcmp/mcf_length.sas
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
Usage:
|
|
15
15
|
|
|
16
|
-
%mcf_length(
|
|
16
|
+
%mcf_length()
|
|
17
17
|
|
|
18
18
|
data _null_;
|
|
19
19
|
ina=1;
|
|
@@ -31,13 +31,11 @@
|
|
|
31
31
|
|
|
32
32
|
> outa=3 outb=4 outc=5 outd=0
|
|
33
33
|
|
|
34
|
-
@param [out] wrap= (
|
|
34
|
+
@param [out] wrap= (YES) Choose NO to omit the proc fcmp wrapper.
|
|
35
35
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
36
36
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
37
37
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
38
38
|
Uses a 3 part format: libref.catalog.package
|
|
39
|
-
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
40
|
-
values inserted only if needed.
|
|
41
39
|
|
|
42
40
|
<h4> SAS Macros </h4>
|
|
43
41
|
@li mcf_init.sas
|
|
@@ -48,8 +46,7 @@
|
|
|
48
46
|
|
|
49
47
|
**/
|
|
50
48
|
|
|
51
|
-
%macro mcf_length(wrap=
|
|
52
|
-
,insert_cmplib=DEPRECATED
|
|
49
|
+
%macro mcf_length(wrap=YES
|
|
53
50
|
,lib=WORK
|
|
54
51
|
,cat=SASJS
|
|
55
52
|
,pkg=UTILS
|
package/fcmp/mcf_string2file.sas
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
Usage:
|
|
18
18
|
|
|
19
|
-
%mcf_string2file(
|
|
19
|
+
%mcf_string2file()
|
|
20
20
|
|
|
21
21
|
data _null_;
|
|
22
22
|
rc=mcf_string2file(
|
|
@@ -31,13 +31,11 @@
|
|
|
31
31
|
putlog _infile_;
|
|
32
32
|
run;
|
|
33
33
|
|
|
34
|
-
@param [out] wrap= (
|
|
34
|
+
@param [out] wrap= (YES) Choose NO to omit the proc fcmp wrapper.
|
|
35
35
|
@param [out] lib= (work) The output library in which to create the catalog.
|
|
36
36
|
@param [out] cat= (sasjs) The output catalog in which to create the package.
|
|
37
37
|
@param [out] pkg= (utils) The output package in which to create the function.
|
|
38
38
|
Uses a 3 part format: libref.catalog.package
|
|
39
|
-
@param [out] insert_cmplib= DEPRECATED - The CMPLIB option is checked and
|
|
40
|
-
values inserted only if needed.
|
|
41
39
|
|
|
42
40
|
<h4> SAS Macros </h4>
|
|
43
41
|
@li mcf_init.sas
|
|
@@ -48,8 +46,7 @@
|
|
|
48
46
|
|
|
49
47
|
**/
|
|
50
48
|
|
|
51
|
-
%macro mcf_string2file(wrap=
|
|
52
|
-
,insert_cmplib=DEPRECATED
|
|
49
|
+
%macro mcf_string2file(wrap=YES
|
|
53
50
|
,lib=WORK
|
|
54
51
|
,cat=SASJS
|
|
55
52
|
,pkg=UTILS
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/core",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Production-quality MIT-licensed SAS macro library (mf_*, mp_*, mm* macros) for SAS 9 and Viya application development",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAS",
|
|
7
7
|
"Viya",
|
|
8
|
-
"SASjs"
|
|
8
|
+
"SASjs",
|
|
9
|
+
"sas-macros",
|
|
10
|
+
"sas-macro-library",
|
|
11
|
+
"sas9",
|
|
12
|
+
"sas-viya",
|
|
13
|
+
"datastep",
|
|
14
|
+
"etl",
|
|
15
|
+
"sasjs-cli"
|
|
9
16
|
],
|
|
10
17
|
"author": "Allan Bowe",
|
|
11
18
|
"repository": {
|
|
@@ -24,7 +31,6 @@
|
|
|
24
31
|
"url": "https://github.com/sasjs/core/issues"
|
|
25
32
|
},
|
|
26
33
|
"homepage": "https://core.sasjs.io",
|
|
27
|
-
"main": "index.js",
|
|
28
34
|
"scripts": {
|
|
29
35
|
"build": "npx @sasjs/cli cbd -t server",
|
|
30
36
|
"docs": "npx @sasjs/cli doc -t docsonly && ./sasjs/utils/build.sh",
|
|
@@ -35,5 +41,5 @@
|
|
|
35
41
|
"maintainers": [
|
|
36
42
|
"https://sasapps.io"
|
|
37
43
|
],
|
|
38
|
-
"version": "
|
|
44
|
+
"version": "5.1.0"
|
|
39
45
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Creates a file in the logical filesystem of the target platform
|
|
4
|
+
@details When building applications that run on multiple flavours of SAS, it
|
|
5
|
+
is convenient to use a single macro (like this one) to write a text file -
|
|
6
|
+
eg a settings file - without worrying about the platform primitive.
|
|
7
|
+
|
|
8
|
+
The file is created in the logical filesystem of the target platform (SAS
|
|
9
|
+
Content folder, SASjs Drive, or metadata folder). No file is created on a
|
|
10
|
+
physical filesystem. Platform behaviour:
|
|
11
|
+
- SASVIYA: creates a SAS Content file (%mv_createfile)
|
|
12
|
+
- SASJS: creates a file on SASjs Drive (%ms_createfile)
|
|
13
|
+
- SAS 9 / metadata: SAS 9 has no "file" concept for Stored Process content,
|
|
14
|
+
so a type 2 Stored Process is created in metadata (%mm_createstp), with
|
|
15
|
+
the content loaded as the STP source code
|
|
16
|
+
|
|
17
|
+
The alternative would be to compile a generic macro in target-specific
|
|
18
|
+
folders (SASVIYA, SAS9 and SASJS). This avoids compiling unnecessary macros
|
|
19
|
+
at the expense of a more complex sasjsconfig.json setup.
|
|
20
|
+
|
|
21
|
+
Usage:
|
|
22
|
+
|
|
23
|
+
filename ft15f001 temp;
|
|
24
|
+
data _null_;
|
|
25
|
+
file ft15f001;
|
|
26
|
+
put '%let mysetting=42;';
|
|
27
|
+
run;
|
|
28
|
+
|
|
29
|
+
%* viya: /Public/app/myapp/settings (Files Service) ;
|
|
30
|
+
%* sasjs: /Public/app/myapp/settings.sas (SASjs Drive) ;
|
|
31
|
+
%* sas9: /User Folders/sasdemo/myapp/settings (metadata) ;
|
|
32
|
+
%let filepath=/Public/app/myapp/settings;
|
|
33
|
+
%mx_createfile(&filepath, inref=ft15f001)
|
|
34
|
+
|
|
35
|
+
@param [in] filepath The full path of the file to create, INCLUDING the
|
|
36
|
+
filename (must contain at least one `/` delimiter). On SASjs Server the
|
|
37
|
+
name should carry the .sas extension if it will be executed as a Stored
|
|
38
|
+
Program.
|
|
39
|
+
@param [in] inref= (0) The fileref containing the file content. A valid
|
|
40
|
+
fileref is mandatory - if omitted, the macro aborts with an error.
|
|
41
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
|
42
|
+
|
|
43
|
+
<h4> SAS Macros </h4>
|
|
44
|
+
@li mf_getplatform.sas
|
|
45
|
+
@li mf_getuniquefileref.sas
|
|
46
|
+
@li mm_createstp.sas
|
|
47
|
+
@li ms_createfile.sas
|
|
48
|
+
@li mv_createfile.sas
|
|
49
|
+
|
|
50
|
+
<h4> Related Macros </h4>
|
|
51
|
+
@li mx_createwebservice.sas
|
|
52
|
+
@li mx_getcode.sas
|
|
53
|
+
|
|
54
|
+
**/
|
|
55
|
+
|
|
56
|
+
%macro mx_createfile(filepath
|
|
57
|
+
,inref=0
|
|
58
|
+
,mdebug=0
|
|
59
|
+
)/*/STORE SOURCE*/;
|
|
60
|
+
|
|
61
|
+
%local platform name shortloc;
|
|
62
|
+
%let platform=%mf_getplatform();
|
|
63
|
+
|
|
64
|
+
%if &inref=0 %then %do;
|
|
65
|
+
%put %str(ERR)OR: &sysmacroname requires a valid inref fileref;
|
|
66
|
+
%return;
|
|
67
|
+
%end;
|
|
68
|
+
|
|
69
|
+
%if &platform=SASJS %then %do;
|
|
70
|
+
%ms_createfile(%superq(filepath), inref=&inref, mdebug=&mdebug)
|
|
71
|
+
%end;
|
|
72
|
+
%else %if &platform=SASVIYA %then %do;
|
|
73
|
+
/* extract name & path from &filepath */
|
|
74
|
+
data _null_;
|
|
75
|
+
filepath=symget('filepath');
|
|
76
|
+
name=scan(filepath,-1,'/');
|
|
77
|
+
shortloc=substr(filepath,1,length(filepath)-length(name)-1);
|
|
78
|
+
call symputx('name',name,'l');
|
|
79
|
+
call symputx('shortloc',shortloc,'l');
|
|
80
|
+
run;
|
|
81
|
+
%mv_createfile(path=%superq(shortloc)
|
|
82
|
+
,name=%superq(name)
|
|
83
|
+
,inref=&inref
|
|
84
|
+
,mdebug=&mdebug
|
|
85
|
+
)
|
|
86
|
+
%end;
|
|
87
|
+
%else %if &platform=SAS9 or &platform=SASMETA %then %do;
|
|
88
|
+
/* no file concept - create a type 2 STP (source code saved in metadata).
|
|
89
|
+
The mm_createstp macro requires a physical file, so copy the inref
|
|
90
|
+
content to WORK first. It then loads the source code, meaning no
|
|
91
|
+
separate mm_updatestpsourcecode call is needed. */
|
|
92
|
+
data _null_;
|
|
93
|
+
filepath=symget('filepath');
|
|
94
|
+
name=scan(filepath,-1,'/');
|
|
95
|
+
shortloc=substr(filepath,1,length(filepath)-length(name)-1);
|
|
96
|
+
call symputx('name',name,'l');
|
|
97
|
+
call symputx('shortloc',shortloc,'l');
|
|
98
|
+
run;
|
|
99
|
+
%local fref;
|
|
100
|
+
%let fref=%mf_getuniquefileref();
|
|
101
|
+
filename &fref "%sysfunc(getoption(work))/%superq(name).sas";
|
|
102
|
+
data _null_;
|
|
103
|
+
infile &inref lrecl=32767;
|
|
104
|
+
file &fref lrecl=32767;
|
|
105
|
+
input;
|
|
106
|
+
put _infile_;
|
|
107
|
+
run;
|
|
108
|
+
%mm_createstp(stpname=%superq(name)
|
|
109
|
+
,tree=%superq(shortloc)
|
|
110
|
+
,filename=%superq(name).sas
|
|
111
|
+
,directory=%sysfunc(getoption(work))
|
|
112
|
+
,stptype=2
|
|
113
|
+
,mdebug=&mdebug
|
|
114
|
+
)
|
|
115
|
+
%if &mdebug=0 %then %do;
|
|
116
|
+
/* remove the temporary physical file */
|
|
117
|
+
%local rc;
|
|
118
|
+
%let rc=%sysfunc(fdelete(&fref));
|
|
119
|
+
filename &fref clear;
|
|
120
|
+
%end;
|
|
121
|
+
%end;
|
|
122
|
+
%else %do;
|
|
123
|
+
%put %str(ERR)OR: &sysmacroname: &platform is unsupported!!!;
|
|
124
|
+
%let syscc=1012;
|
|
125
|
+
%end;
|
|
126
|
+
|
|
127
|
+
%mend mx_createfile;
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
@li mv_jobflow.sas
|
|
46
46
|
|
|
47
47
|
<h4> Related Programs </h4>
|
|
48
|
-
@li
|
|
48
|
+
@li mx_execute.test.sas
|
|
49
49
|
|
|
50
50
|
@version 9.4
|
|
51
51
|
@author Allan Bowe
|
|
52
52
|
|
|
53
53
|
**/
|
|
54
54
|
|
|
55
|
-
%macro
|
|
55
|
+
%macro mx_execute(program,
|
|
56
56
|
inputfiles=0,
|
|
57
57
|
inputdatasets=0,
|
|
58
58
|
inputparams=0,
|
|
@@ -296,4 +296,4 @@ filename &webref "&webrefpath";
|
|
|
296
296
|
%put _local_;
|
|
297
297
|
%end;
|
|
298
298
|
|
|
299
|
-
%mend
|
|
299
|
+
%mend mx_execute;
|
package/base/mp_coretable.sas
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@file
|
|
3
|
-
@brief Create the permanent Core tables
|
|
4
|
-
@details Several macros in the [core](https://github.com/sasjs/core) library
|
|
5
|
-
make use of permanent tables. To avoid duplication in definitions, this
|
|
6
|
-
macro provides a central location for managing the corresponding DDL.
|
|
7
|
-
|
|
8
|
-
Note - this macro is likely to be deprecated in future in favour of a
|
|
9
|
-
dedicated "datamodel" folder (prefix mddl)
|
|
10
|
-
|
|
11
|
-
Any corresponding data would go in a seperate repo, to avoid this one
|
|
12
|
-
ballooning in size!
|
|
13
|
-
|
|
14
|
-
Example usage:
|
|
15
|
-
|
|
16
|
-
%mp_coretable(LOCKTABLE,libds=work.locktable)
|
|
17
|
-
|
|
18
|
-
@param [in] table_ref The type of table to create. Example values:
|
|
19
|
-
@li DIFFTABLE
|
|
20
|
-
@li FILTER_DETAIL
|
|
21
|
-
@li FILTER_SUMMARY
|
|
22
|
-
@li LOCKANYTABLE
|
|
23
|
-
@li MAXKEYTABLE
|
|
24
|
-
@param [in] libds= (0) The library.dataset reference used to create the table.
|
|
25
|
-
If not provided, then the DDL is simply printed to the log.
|
|
26
|
-
|
|
27
|
-
<h4> SAS Macros </h4>
|
|
28
|
-
@li mddl_dc_difftable.sas
|
|
29
|
-
@li mddl_dc_filterdetail.sas
|
|
30
|
-
@li mddl_dc_filtersummary.sas
|
|
31
|
-
@li mddl_dc_locktable.sas
|
|
32
|
-
@li mddl_dc_maxkeytable.sas
|
|
33
|
-
@li mf_getuniquename.sas
|
|
34
|
-
|
|
35
|
-
<h4> Related Macros </h4>
|
|
36
|
-
@li mp_filterstore.sas
|
|
37
|
-
@li mp_lockanytable.sas
|
|
38
|
-
@li mp_retainedkey.sas
|
|
39
|
-
@li mp_storediffs.sas
|
|
40
|
-
@li mp_stackdiffs.sas
|
|
41
|
-
|
|
42
|
-
@version 9.2
|
|
43
|
-
@author Allan Bowe
|
|
44
|
-
|
|
45
|
-
**/
|
|
46
|
-
|
|
47
|
-
%macro mp_coretable(table_ref,libds=0
|
|
48
|
-
)/*/STORE SOURCE*/;
|
|
49
|
-
%local outds ;
|
|
50
|
-
%let outds=%sysfunc(ifc(&libds=0,%mf_getuniquename(),&libds));
|
|
51
|
-
proc sql;
|
|
52
|
-
%if &table_ref=DIFFTABLE %then %do;
|
|
53
|
-
%mddl_dc_difftable(libds=&outds)
|
|
54
|
-
%end;
|
|
55
|
-
%else %if &table_ref=LOCKTABLE %then %do;
|
|
56
|
-
%mddl_dc_locktable(libds=&outds)
|
|
57
|
-
%end;
|
|
58
|
-
%else %if &table_ref=FILTER_SUMMARY %then %do;
|
|
59
|
-
%mddl_dc_filtersummary(libds=&outds)
|
|
60
|
-
%end;
|
|
61
|
-
%else %if &table_ref=FILTER_DETAIL %then %do;
|
|
62
|
-
%mddl_dc_filterdetail(libds=&outds)
|
|
63
|
-
%end;
|
|
64
|
-
%else %if &table_ref=MAXKEYTABLE %then %do;
|
|
65
|
-
%mddl_dc_maxkeytable(libds=&outds)
|
|
66
|
-
%end;
|
|
67
|
-
|
|
68
|
-
%if &libds=0 %then %do;
|
|
69
|
-
proc sql;
|
|
70
|
-
describe table &syslast;
|
|
71
|
-
drop table &syslast;
|
|
72
|
-
%end;
|
|
73
|
-
%mend mp_coretable;
|