@sasjs/core 4.4.5 → 4.6.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 +19 -7
- package/base/mf_verifymacvars.sas +13 -6
- package/base/mp_coretable.sas +23 -70
- package/base/mp_ds2ddl.sas +30 -0
- package/base/mp_filtercheck.sas +3 -2
- package/base/mp_filterstore.sas +29 -5
- package/base/mp_getformats.sas +6 -24
- package/ddl/mddl_dc_difftable.sas +34 -0
- package/ddl/mddl_dc_filterdetail.sas +27 -0
- package/ddl/mddl_dc_filtersummary.sas +22 -0
- package/ddl/mddl_dc_locktable.sas +25 -0
- package/ddl/mddl_dc_maxkeytable.sas +24 -0
- package/ddl/mddl_sas_cntlout.sas +38 -0
- package/meta/mm_createapplication.sas +4 -1
- package/meta/mm_createdocument.sas +4 -1
- package/meta/mm_createlibrary.sas +7 -5
- package/meta/mm_createstp.sas +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,19 +31,28 @@ Documentation: https://core.sasjs.io
|
|
|
31
31
|
|
|
32
32
|
## Components
|
|
33
33
|
|
|
34
|
-
### BASE library (
|
|
34
|
+
### BASE library (All Platforms)
|
|
35
35
|
|
|
36
36
|
- OS independent
|
|
37
|
-
-
|
|
37
|
+
- Works on all SAS Platforms
|
|
38
38
|
- No X command
|
|
39
39
|
- Prefixes: _mf_, _mp_
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### DDL library (All Platforms)
|
|
42
|
+
|
|
43
|
+
- OS independent
|
|
44
|
+
- Works on all SAS Platforms
|
|
45
|
+
- No X command
|
|
46
|
+
- Prefixes: _mddl_(lib)_ -> where lib can be "SAS" (in relation to a SAS component) or "DC" (in relation to a Data Controller component)
|
|
47
|
+
|
|
48
|
+
This library will not be used for storing data entries (such as formats or datalines). Where this becomes necessary in the future, a new repo will be created, in order to keep the NPM bundle size down (for the benefit of those looking to embed purely macros in their applications).
|
|
49
|
+
|
|
50
|
+
#### FCMP library (All Platforms)
|
|
51
|
+
|
|
42
52
|
- Function and macro names are identical, except for special cases
|
|
43
53
|
- Prefixes: _mcf_
|
|
44
54
|
|
|
45
|
-
The fcmp macros are used to generate fcmp functions, and can be used with or
|
|
46
|
-
without the `proc fcmp` wrapper.
|
|
55
|
+
The fcmp macros are used to generate fcmp functions, and can be used with or without the `proc fcmp` wrapper.
|
|
47
56
|
|
|
48
57
|
### META library (SAS9 only)
|
|
49
58
|
|
|
@@ -125,6 +134,7 @@ filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
|
|
125
134
|
- one macro per file
|
|
126
135
|
- prefixes:
|
|
127
136
|
- _mcf_ for macro compiled functions (proc fcmp)
|
|
137
|
+
- _mddl_ for macros containing DDL (Data Definition Language)
|
|
128
138
|
- _mf_ for macro functions (can be used in open code).
|
|
129
139
|
- _ml_ for macros that are used to compile LUA modules
|
|
130
140
|
- _mm_ for metadata macros (interface with the metadata server).
|
|
@@ -192,11 +202,13 @@ When contributing to this library, it is therefore important to ensure that all
|
|
|
192
202
|
|
|
193
203
|
## Breaking Changes
|
|
194
204
|
|
|
195
|
-
We are currently on major release v4. Breaking changes should be marked with the [deprecated](https://www.doxygen.nl/manual/commands.html#cmddeprecated) doxygen tag. The following changes are planned when the next major (
|
|
205
|
+
We are currently on major release v4. Breaking changes should be marked with the [deprecated](https://www.doxygen.nl/manual/commands.html#cmddeprecated) doxygen tag. The following changes are planned when the next major/breaking release (v5) becomes necessary:
|
|
196
206
|
|
|
197
207
|
* mp_testservice.sas to be renamed as mp_execute.sas (as it doesn't actually test anything)
|
|
198
208
|
* `insert_cmplib` option of mcf_xxx macros will be deprecated (the option is now checked automatically with value inserted only if needed)
|
|
199
|
-
* mcf_xxx macros to have `wrap=` option defaulted to YES for convenience
|
|
209
|
+
* mcf_xxx macros to have `wrap=` option defaulted to YES for convenience. Set this option explicitly to avoid issues.
|
|
210
|
+
* mp_getddl.sas to be renamed to mp_ds2ddl.sas (consistent with other ds2xxx macros). A wrapper macro is already in place, and you are able to use this immediately. The default for SHOWLOG will also be YES instead of NO.
|
|
211
|
+
* mp_coretable.sas will be replaced by the standalone macros in the `ddl` folder (which are already available)
|
|
200
212
|
|
|
201
213
|
## Star Gazing
|
|
202
214
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@file
|
|
3
|
-
@brief Checks if a set of macro variables exist
|
|
3
|
+
@brief Checks if a set of macro variables exist AND contain values.
|
|
4
4
|
@details Writes ERROR to log if abortType is SOFT, else will call %mf_abort.
|
|
5
5
|
Usage:
|
|
6
6
|
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
<h4> SAS Macros </h4>
|
|
15
15
|
@li mf_abort.sas
|
|
16
16
|
|
|
17
|
-
@param verifyvars
|
|
18
|
-
@param makeupcase=
|
|
17
|
+
@param [in] verifyvars Space separated list of macro variable names
|
|
18
|
+
@param [in] makeupcase= (NO) Set to YES to convert all variable VALUES to
|
|
19
19
|
uppercase.
|
|
20
|
-
@param mAbort= Abort Type.
|
|
20
|
+
@param [in] mAbort= (SOFT) Abort Type. When SOFT, simply writes an err
|
|
21
|
+
message to the log.
|
|
21
22
|
Set to any other value to call mf_abort (which can be configured to abort in
|
|
22
23
|
various fashions according to context).
|
|
23
24
|
|
|
@@ -58,8 +59,14 @@
|
|
|
58
59
|
|
|
59
60
|
%goto exit_success;
|
|
60
61
|
%exit_err:
|
|
61
|
-
%
|
|
62
|
-
%
|
|
62
|
+
%put %str(ERR)OR: &abortmsg;
|
|
63
|
+
%mf_abort(iftrue=(&mabort ne SOFT),
|
|
64
|
+
mac=mf_verifymacvars,
|
|
65
|
+
msg=%str(&abortmsg)
|
|
66
|
+
)
|
|
67
|
+
0
|
|
68
|
+
%return;
|
|
63
69
|
%exit_success:
|
|
70
|
+
1
|
|
64
71
|
|
|
65
72
|
%mend mf_verifymacvars;
|
package/base/mp_coretable.sas
CHANGED
|
@@ -5,24 +5,32 @@
|
|
|
5
5
|
make use of permanent tables. To avoid duplication in definitions, this
|
|
6
6
|
macro provides a central location for managing the corresponding DDL.
|
|
7
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
|
+
|
|
8
14
|
Example usage:
|
|
9
15
|
|
|
10
16
|
%mp_coretable(LOCKTABLE,libds=work.locktable)
|
|
11
17
|
|
|
12
18
|
@param [in] table_ref The type of table to create. Example values:
|
|
13
|
-
@li DIFFTABLE
|
|
14
|
-
|
|
15
|
-
@li
|
|
16
|
-
|
|
17
|
-
@li
|
|
18
|
-
mp_filterstore.sas.
|
|
19
|
-
@li LOCKANYTABLE - For "locking" tables prior to multipass loads. Used by
|
|
20
|
-
mp_lockanytable.sas
|
|
21
|
-
@li MAXKEYTABLE - For storing the maximum retained key information. Used
|
|
22
|
-
by mp_retainedkey.sas
|
|
19
|
+
@li DIFFTABLE
|
|
20
|
+
@li FILTER_DETAIL
|
|
21
|
+
@li FILTER_SUMMARY
|
|
22
|
+
@li LOCKANYTABLE
|
|
23
|
+
@li MAXKEYTABLE
|
|
23
24
|
@param [in] libds= (0) The library.dataset reference used to create the table.
|
|
24
25
|
If not provided, then the DDL is simply printed to the log.
|
|
25
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
|
+
|
|
26
34
|
<h4> Related Macros </h4>
|
|
27
35
|
@li mp_filterstore.sas
|
|
28
36
|
@li mp_lockanytable.sas
|
|
@@ -41,76 +49,21 @@
|
|
|
41
49
|
%let outds=%sysfunc(ifc(&libds=0,_data_,&libds));
|
|
42
50
|
proc sql;
|
|
43
51
|
%if &table_ref=DIFFTABLE %then %do;
|
|
44
|
-
|
|
45
|
-
load_ref char(36) label='unique load reference',
|
|
46
|
-
processed_dttm num format=E8601DT26.6 label='Processed at timestamp',
|
|
47
|
-
libref char(8) label='Library Reference (8 chars)',
|
|
48
|
-
dsn char(32) label='Dataset Name (32 chars)',
|
|
49
|
-
key_hash char(32) label=
|
|
50
|
-
'MD5 Hash of primary key values (pipe seperated)',
|
|
51
|
-
move_type char(1) label='Either (A)ppended, (D)eleted or (M)odified',
|
|
52
|
-
is_pk num label='Is Primary Key Field? (1/0)',
|
|
53
|
-
is_diff num label=
|
|
54
|
-
'Did value change? (1/0/-1). Always -1 for appends and deletes.',
|
|
55
|
-
tgtvar_type char(1) label='Either (C)haracter or (N)umeric',
|
|
56
|
-
tgtvar_nm char(32) label='Target variable name (32 chars)',
|
|
57
|
-
oldval_num num format=best32. label='Old (numeric) value',
|
|
58
|
-
newval_num num format=best32. label='New (numeric) value',
|
|
59
|
-
oldval_char char(32765) label='Old (character) value',
|
|
60
|
-
newval_char char(32765) label='New (character) value',
|
|
61
|
-
constraint pk_mpe_audit
|
|
62
|
-
primary key(load_ref,libref,dsn,key_hash,tgtvar_nm)
|
|
63
|
-
);
|
|
52
|
+
%mddl_dc_difftable(libds=&outds)
|
|
64
53
|
%end;
|
|
65
54
|
%else %if &table_ref=LOCKTABLE %then %do;
|
|
66
|
-
|
|
67
|
-
lock_lib char(8),
|
|
68
|
-
lock_ds char(32),
|
|
69
|
-
lock_status_cd char(10) not null,
|
|
70
|
-
lock_user_nm char(100) not null ,
|
|
71
|
-
lock_ref char(200),
|
|
72
|
-
lock_pid char(10),
|
|
73
|
-
lock_start_dttm num format=E8601DT26.6,
|
|
74
|
-
lock_end_dttm num format=E8601DT26.6,
|
|
75
|
-
constraint pk_mp_lockanytable primary key(lock_lib,lock_ds));
|
|
55
|
+
%mddl_dc_locktable(libds=&outds)
|
|
76
56
|
%end;
|
|
77
57
|
%else %if &table_ref=FILTER_SUMMARY %then %do;
|
|
78
|
-
|
|
79
|
-
filter_rk num not null,
|
|
80
|
-
filter_hash char(32) not null,
|
|
81
|
-
filter_table char(41) not null,
|
|
82
|
-
processed_dttm num not null format=E8601DT26.6,
|
|
83
|
-
constraint pk_mpe_filteranytable
|
|
84
|
-
primary key(filter_rk));
|
|
58
|
+
%mddl_dc_filtersummary(libds=&outds)
|
|
85
59
|
%end;
|
|
86
60
|
%else %if &table_ref=FILTER_DETAIL %then %do;
|
|
87
|
-
|
|
88
|
-
filter_hash char(32) not null,
|
|
89
|
-
filter_line num not null,
|
|
90
|
-
group_logic char(3) not null,
|
|
91
|
-
subgroup_logic char(3) not null,
|
|
92
|
-
subgroup_id num not null,
|
|
93
|
-
variable_nm varchar(32) not null,
|
|
94
|
-
operator_nm varchar(12) not null,
|
|
95
|
-
raw_value varchar(4000) not null,
|
|
96
|
-
processed_dttm num not null format=E8601DT26.6,
|
|
97
|
-
constraint pk_mpe_filteranytable
|
|
98
|
-
primary key(filter_hash,filter_line));
|
|
61
|
+
%mddl_dc_filterdetail(libds=&outds)
|
|
99
62
|
%end;
|
|
100
63
|
%else %if &table_ref=MAXKEYTABLE %then %do;
|
|
101
|
-
|
|
102
|
-
keytable varchar(41) label='Base table in libref.dataset format',
|
|
103
|
-
keycolumn char(32) format=$32.
|
|
104
|
-
label='The Retained key field containing the key values.',
|
|
105
|
-
max_key num label=
|
|
106
|
-
'Integer representing current max RK or SK value in the KEYTABLE',
|
|
107
|
-
processed_dttm num format=E8601DT26.6
|
|
108
|
-
label='Datetime this value was last updated',
|
|
109
|
-
constraint pk_mpe_maxkeyvalues
|
|
110
|
-
primary key(keytable));
|
|
64
|
+
%mddl_dc_maxkeytable(libds=&outds)
|
|
111
65
|
%end;
|
|
112
66
|
|
|
113
|
-
|
|
114
67
|
%if &libds=0 %then %do;
|
|
115
68
|
describe table &syslast;
|
|
116
69
|
drop table &syslast;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief A wrapper for mp_getddl.sas
|
|
4
|
+
@details In the next release, this will be the main version.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<h4> SAS Macros </h4>
|
|
8
|
+
@li mp_getddl.sas
|
|
9
|
+
|
|
10
|
+
**/
|
|
11
|
+
|
|
12
|
+
%macro mp_ds2ddl(libds,fref=getddl,flavour=SAS,showlog=YES,schema=
|
|
13
|
+
,applydttm=NO
|
|
14
|
+
)/*/STORE SOURCE*/;
|
|
15
|
+
|
|
16
|
+
%local libref;
|
|
17
|
+
%let libds=%upcase(&libds);
|
|
18
|
+
%let libref=%scan(&libds,1,.);
|
|
19
|
+
%if &libref=&libds %then %let libds=WORK.&libds;
|
|
20
|
+
|
|
21
|
+
%mp_getddl(%scan(&libds,1,.)
|
|
22
|
+
,%scan(&libds,2,.)
|
|
23
|
+
,fref=&fref
|
|
24
|
+
,flavour=SAS
|
|
25
|
+
,showlog=&showlog
|
|
26
|
+
,schema=&schema
|
|
27
|
+
,applydttm=&applydttm
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
%mend mp_ds2ddl;
|
package/base/mp_filtercheck.sas
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
SYSCC to 1008 if bad records are found, and call mp_abort.sas for a
|
|
7
7
|
graceful service exit (configurable).
|
|
8
8
|
|
|
9
|
-
Used for dynamic filtering in [Data Controller for SAS®](
|
|
9
|
+
Used for dynamic filtering in [Data Controller for SAS®](
|
|
10
|
+
https://datacontroller.io).
|
|
10
11
|
|
|
11
12
|
Usage:
|
|
12
13
|
|
|
@@ -125,7 +126,7 @@ data &outds;
|
|
|
125
126
|
output;
|
|
126
127
|
end;
|
|
127
128
|
if OPERATOR_NM not in
|
|
128
|
-
('=','>','<','<=','>=','BETWEEN','IN','NOT IN','NE','CONTAINS')
|
|
129
|
+
('=','>','<','<=','>=','BETWEEN','IN','NOT IN','NE','CONTAINS','GE','LE')
|
|
129
130
|
then do;
|
|
130
131
|
REASON_CD='Invalid OPERATOR_NM: '!!cats(OPERATOR_NM);
|
|
131
132
|
putlog REASON_CD= OPERATOR_NM=;
|
package/base/mp_filterstore.sas
CHANGED
|
@@ -8,8 +8,13 @@
|
|
|
8
8
|
https://sasapps.io)). This macro is also used in [Data Controller for SAS](
|
|
9
9
|
https://datacontroller.io).
|
|
10
10
|
|
|
11
|
+
A more recent feature of this macro is the ability to support filter queries
|
|
12
|
+
on Format Catalogs. This is achieved by adding a `-FC` suffix to the `libds`
|
|
13
|
+
parameter - where the "ds" in this case is the catalog name.
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
@param [in] libds= The target dataset to be filtered (lib should be assigned).
|
|
17
|
+
If filtering a format catalog, add the following suffix: `-FC`.
|
|
13
18
|
@param [in] queryds= (WORK.FILTERQUERY) The temporary input query dataset to
|
|
14
19
|
be validated. Has the following format:
|
|
15
20
|
|GROUP_LOGIC:$3|SUBGROUP_LOGIC:$3|SUBGROUP_ID:8.|VARIABLE_NM:$32|OPERATOR_NM:$10|RAW_VALUE:$32767|
|
|
@@ -45,6 +50,7 @@
|
|
|
45
50
|
|
|
46
51
|
|
|
47
52
|
<h4> SAS Macros </h4>
|
|
53
|
+
@li mddl_sas_cntlout.sas
|
|
48
54
|
@li mf_getuniquename.sas
|
|
49
55
|
@li mf_getvalue.sas
|
|
50
56
|
@li mf_islibds.sas
|
|
@@ -78,7 +84,10 @@
|
|
|
78
84
|
%put &sysmacroname entry vars:;
|
|
79
85
|
%put _local_;
|
|
80
86
|
|
|
81
|
-
%local ds1 ds2 ds3 ds4 filter_hash;
|
|
87
|
+
%local ds0 ds1 ds2 ds3 ds4 filter_hash orig_libds;
|
|
88
|
+
%let libds=%upcase(&libds);
|
|
89
|
+
%let orig_libds=&libds;
|
|
90
|
+
|
|
82
91
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
83
92
|
,mac=mp_filterstore
|
|
84
93
|
,msg=%str(syscc=&syscc on macro entry)
|
|
@@ -96,12 +105,27 @@
|
|
|
96
105
|
,msg=%str(Invalid lock_table value: &lock_table)
|
|
97
106
|
)
|
|
98
107
|
|
|
99
|
-
|
|
108
|
+
/**
|
|
109
|
+
* validate query
|
|
110
|
+
* use format catalog export, if a format
|
|
111
|
+
*/
|
|
112
|
+
%if "%substr(&libds,%length(&libds)-2,3)"="-FC" %then %do;
|
|
113
|
+
%let libds=%scan(&libds,1,-); /* chop off -FC extension */
|
|
114
|
+
%let ds0=%mf_getuniquename(prefix=fmtds_);
|
|
115
|
+
%let libds=&ds0;
|
|
116
|
+
/*
|
|
117
|
+
There is no need to export the entire format catalog here - the validations
|
|
118
|
+
are done against the data model, not the data values. So we can simply
|
|
119
|
+
hardcode the structure based on the cntlout dataset.
|
|
120
|
+
*/
|
|
121
|
+
%mddl_sas_cntlout(libds=&ds0)
|
|
122
|
+
|
|
123
|
+
%end;
|
|
100
124
|
%mp_filtercheck(&queryds,targetds=&libds,abort=YES)
|
|
101
125
|
|
|
102
126
|
/* hash the result */
|
|
103
127
|
%let ds1=%mf_getuniquename(prefix=hashds);
|
|
104
|
-
%mp_hashdataset(&queryds,outds=&ds1,salt=&
|
|
128
|
+
%mp_hashdataset(&queryds,outds=&ds1,salt=&orig_libds)
|
|
105
129
|
%let filter_hash=%upcase(%mf_getvalue(&ds1,hashkey));
|
|
106
130
|
%if &mdebug=1 %then %do;
|
|
107
131
|
data _null_;
|
|
@@ -132,7 +156,7 @@ run;
|
|
|
132
156
|
%let ds3=%mf_getuniquename(prefix=filtersum);
|
|
133
157
|
data work.&ds3;
|
|
134
158
|
if 0 then set &filter_summary;
|
|
135
|
-
filter_table=
|
|
159
|
+
filter_table="&orig_libds";
|
|
136
160
|
filter_hash="&filter_hash";
|
|
137
161
|
PROCESSED_DTTM=%sysfunc(datetime());
|
|
138
162
|
output;
|
package/base/mp_getformats.sas
CHANGED
|
@@ -40,6 +40,7 @@ https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#
|
|
|
40
40
|
|`WHICHPATH `|`**OTHER** `|`**OTHER** `|`big fat problem if not path1 `|`1 `|`40 `|`28 `|`28 `|`1E-12 `|` `|`0 `|` `|`0 `|`N `|`N `|`N `|`O `|` `|` `|` `|` `|
|
|
41
41
|
|
|
42
42
|
<h4> SAS Macros </h4>
|
|
43
|
+
@li mddl_sas_cntlout.sas
|
|
43
44
|
@li mf_dedup.sas
|
|
44
45
|
@li mf_getfmtlist.sas
|
|
45
46
|
@li mf_getfmtname.sas
|
|
@@ -94,30 +95,7 @@ create table &outsummary as
|
|
|
94
95
|
|
|
95
96
|
%if "&outdetail" ne "0" %then %do;
|
|
96
97
|
/* ensure base table always exists */
|
|
97
|
-
|
|
98
|
-
create table &outdetail(
|
|
99
|
-
FMTNAME char(32) label='Format name'
|
|
100
|
-
,START char(16) label='Starting value for format'
|
|
101
|
-
,END char(16) label='Ending value for format'
|
|
102
|
-
,LABEL char(256) label='Format value label'
|
|
103
|
-
,MIN num length=3 label='Minimum length'
|
|
104
|
-
,MAX num length=3 label='Maximum length'
|
|
105
|
-
,DEFAULT num length=3 label='Default length'
|
|
106
|
-
,LENGTH num length=3 label='Format length'
|
|
107
|
-
,FUZZ num label='Fuzz value'
|
|
108
|
-
,PREFIX char(2) label='Prefix characters'
|
|
109
|
-
,MULT num label='Multiplier'
|
|
110
|
-
,FILL char(1) label='Fill character'
|
|
111
|
-
,NOEDIT num length=3 label='Is picture string noedit?'
|
|
112
|
-
,TYPE char(1) label='Type of format'
|
|
113
|
-
,SEXCL char(1) label='Start exclusion'
|
|
114
|
-
,EEXCL char(1) label='End exclusion'
|
|
115
|
-
,HLO char(13) label='Additional information'
|
|
116
|
-
,DECSEP char(1) label='Decimal separator'
|
|
117
|
-
,DIG3SEP char(1) label='Three-digit separator'
|
|
118
|
-
,DATATYPE char(8) label='Date/time/datetime?'
|
|
119
|
-
,LANGUAGE char(8) label='Language for date strings'
|
|
120
|
-
);
|
|
98
|
+
%mddl_sas_cntlout(libds=&outdetail)
|
|
121
99
|
/* grab the location of each format */
|
|
122
100
|
%let fmtcnt=0;
|
|
123
101
|
data _null_;
|
|
@@ -134,6 +112,10 @@ create table &outsummary as
|
|
|
134
112
|
proc format library=&&fmtloc&i CNTLOUT=&tempds;
|
|
135
113
|
select &&fmtname&i;
|
|
136
114
|
run;
|
|
115
|
+
data &tempds;
|
|
116
|
+
length label $256;
|
|
117
|
+
set &tempds;
|
|
118
|
+
run;
|
|
137
119
|
proc append base=&outdetail data=&tempds;
|
|
138
120
|
run;
|
|
139
121
|
%end;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Difftable DDL
|
|
4
|
+
@details Used to store changes to tables. Used by mp_storediffs.sas
|
|
5
|
+
and mp_stackdiffs.sas
|
|
6
|
+
|
|
7
|
+
**/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
%macro mddl_dc_difftable(libds=WORK.DIFFTABLE);
|
|
11
|
+
|
|
12
|
+
proc sql;
|
|
13
|
+
create table &libds(
|
|
14
|
+
load_ref char(36) label='unique load reference',
|
|
15
|
+
processed_dttm num format=E8601DT26.6 label='Processed at timestamp',
|
|
16
|
+
libref char(8) label='Library Reference (8 chars)',
|
|
17
|
+
dsn char(32) label='Dataset Name (32 chars)',
|
|
18
|
+
key_hash char(32) label=
|
|
19
|
+
'MD5 Hash of primary key values (pipe seperated)',
|
|
20
|
+
move_type char(1) label='Either (A)ppended, (D)eleted or (M)odified',
|
|
21
|
+
is_pk num label='Is Primary Key Field? (1/0)',
|
|
22
|
+
is_diff num label=
|
|
23
|
+
'Did value change? (1/0/-1). Always -1 for appends and deletes.',
|
|
24
|
+
tgtvar_type char(1) label='Either (C)haracter or (N)umeric',
|
|
25
|
+
tgtvar_nm char(32) label='Target variable name (32 chars)',
|
|
26
|
+
oldval_num num format=best32. label='Old (numeric) value',
|
|
27
|
+
newval_num num format=best32. label='New (numeric) value',
|
|
28
|
+
oldval_char char(32765) label='Old (character) value',
|
|
29
|
+
newval_char char(32765) label='New (character) value',
|
|
30
|
+
constraint pk_mpe_audit
|
|
31
|
+
primary key(load_ref,libref,dsn,key_hash,tgtvar_nm)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
%mend mddl_dc_difftable;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Filtertable DDL
|
|
4
|
+
@details For storing detailed filter values. Used by
|
|
5
|
+
mp_filterstore.sas.
|
|
6
|
+
|
|
7
|
+
**/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
%macro mddl_dc_filterdetail(libds=WORK.FILTER_DETAIL);
|
|
11
|
+
|
|
12
|
+
proc sql;
|
|
13
|
+
create table &libds(
|
|
14
|
+
filter_hash char(32) not null,
|
|
15
|
+
filter_line num not null,
|
|
16
|
+
group_logic char(3) not null,
|
|
17
|
+
subgroup_logic char(3) not null,
|
|
18
|
+
subgroup_id num not null,
|
|
19
|
+
variable_nm varchar(32) not null,
|
|
20
|
+
operator_nm varchar(12) not null,
|
|
21
|
+
raw_value varchar(4000) not null,
|
|
22
|
+
processed_dttm num not null format=E8601DT26.6,
|
|
23
|
+
constraint pk_mpe_filteranytable
|
|
24
|
+
primary key(filter_hash,filter_line)
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
%mend mddl_dc_filterdetail;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Filtersummary DDL
|
|
4
|
+
@details For storing summary filter values. Used by
|
|
5
|
+
mp_filterstore.sas.
|
|
6
|
+
|
|
7
|
+
**/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
%macro mddl_dc_filtersummary(libds=WORK.FILTER_SUMMARY);
|
|
11
|
+
|
|
12
|
+
proc sql;
|
|
13
|
+
create table &libds(
|
|
14
|
+
filter_rk num not null,
|
|
15
|
+
filter_hash char(32) not null,
|
|
16
|
+
filter_table char(41) not null,
|
|
17
|
+
processed_dttm num not null format=E8601DT26.6,
|
|
18
|
+
constraint pk_mpe_filteranytable
|
|
19
|
+
primary key(filter_rk)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
%mend mddl_dc_filtersummary;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Locktable DDL
|
|
4
|
+
@details For "locking" tables prior to multipass loads. Used by
|
|
5
|
+
mp_lockanytable.sas
|
|
6
|
+
|
|
7
|
+
**/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
%macro mddl_dc_locktable(libds=WORK.LOCKTABLE);
|
|
11
|
+
|
|
12
|
+
proc sql;
|
|
13
|
+
create table &libds(
|
|
14
|
+
lock_lib char(8),
|
|
15
|
+
lock_ds char(32),
|
|
16
|
+
lock_status_cd char(10) not null,
|
|
17
|
+
lock_user_nm char(100) not null ,
|
|
18
|
+
lock_ref char(200),
|
|
19
|
+
lock_pid char(10),
|
|
20
|
+
lock_start_dttm num format=E8601DT26.6,
|
|
21
|
+
lock_end_dttm num format=E8601DT26.6,
|
|
22
|
+
constraint pk_mp_lockanytable primary key(lock_lib,lock_ds)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
%mend mddl_dc_locktable;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Maxkeytable DDL
|
|
4
|
+
@details For storing the maximum retained key information. Used
|
|
5
|
+
by mp_retainedkey.sas
|
|
6
|
+
|
|
7
|
+
**/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
%macro mddl_dc_maxkeytable(libds=WORK.MAXKEYTABLE);
|
|
11
|
+
|
|
12
|
+
proc sql;
|
|
13
|
+
create table &libds(
|
|
14
|
+
keytable varchar(41) label='Base table in libref.dataset format',
|
|
15
|
+
keycolumn char(32) format=$32.
|
|
16
|
+
label='The Retained key field containing the key values.',
|
|
17
|
+
max_key num label=
|
|
18
|
+
'Integer representing current max RK or SK value in the KEYTABLE',
|
|
19
|
+
processed_dttm num format=E8601DT26.6
|
|
20
|
+
label='Datetime this value was last updated',
|
|
21
|
+
constraint pk_mpe_maxkeyvalues
|
|
22
|
+
primary key(keytable));
|
|
23
|
+
|
|
24
|
+
%mend mddl_dc_maxkeytable;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief The CNTLOUT table generated by proc format
|
|
4
|
+
@details This table will actually change format depending on the data values,
|
|
5
|
+
therefore the max possible lengths are described here to enable consistency
|
|
6
|
+
when dealing with format data.
|
|
7
|
+
|
|
8
|
+
**/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
%macro mddl_sas_cntlout(libds=WORK.CNTLOUT);
|
|
12
|
+
|
|
13
|
+
proc sql;
|
|
14
|
+
create table &libds(
|
|
15
|
+
FMTNAME char(32) label='Format name'
|
|
16
|
+
,START char(16) label='Starting value for format'
|
|
17
|
+
,END char(16) label='Ending value for format'
|
|
18
|
+
,LABEL char(256) label='Format value label'
|
|
19
|
+
,MIN num length=3 label='Minimum length'
|
|
20
|
+
,MAX num length=3 label='Maximum length'
|
|
21
|
+
,DEFAULT num length=3 label='Default length'
|
|
22
|
+
,LENGTH num length=3 label='Format length'
|
|
23
|
+
,FUZZ num label='Fuzz value'
|
|
24
|
+
,PREFIX char(2) label='Prefix characters'
|
|
25
|
+
,MULT num label='Multiplier'
|
|
26
|
+
,FILL char(1) label='Fill character'
|
|
27
|
+
,NOEDIT num length=3 label='Is picture string noedit?'
|
|
28
|
+
,TYPE char(1) label='Type of format'
|
|
29
|
+
,SEXCL char(1) label='Start exclusion'
|
|
30
|
+
,EEXCL char(1) label='End exclusion'
|
|
31
|
+
,HLO char(13) label='Additional information'
|
|
32
|
+
,DECSEP char(1) label='Decimal separator'
|
|
33
|
+
,DIG3SEP char(1) label='Three-digit separator'
|
|
34
|
+
,DATATYPE char(8) label='Date/time/datetime?'
|
|
35
|
+
,LANGUAGE char(8) label='Language for date strings'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
%mend mddl_sas_cntlout;
|
|
@@ -133,12 +133,14 @@ run;
|
|
|
133
133
|
filename &frefin temp;
|
|
134
134
|
filename &frefout temp;
|
|
135
135
|
|
|
136
|
-
%
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
%mp_abort(iftrue= (
|
|
137
|
+
&engine=BASE & %mf_verifymacvars(libname libref engine servercontext tree)=0
|
|
138
|
+
)
|
|
139
|
+
,mac=&sysmacroname
|
|
140
|
+
,msg=%str(Empty inputs: libname libref engine servercontext tree)
|
|
141
|
+
)
|
|
141
142
|
|
|
143
|
+
%if &engine=BASE %then %do;
|
|
142
144
|
/**
|
|
143
145
|
* Check that the ServerContext exists
|
|
144
146
|
*/
|
package/meta/mm_createstp.sas
CHANGED
|
@@ -108,7 +108,12 @@
|
|
|
108
108
|
%&mD.put Executing mm_CreateSTP.sas;
|
|
109
109
|
%&mD.put _local_;
|
|
110
110
|
|
|
111
|
-
%
|
|
111
|
+
%mp_abort(
|
|
112
|
+
iftrue=(%mf_verifymacvars(stpname filename directory tree)=0)
|
|
113
|
+
,mac=&sysmacroname
|
|
114
|
+
,msg=%str(Empty inputs: stpname filename directory tree)
|
|
115
|
+
)
|
|
116
|
+
|
|
112
117
|
%mp_dropmembers(%scan(&outds,2,.))
|
|
113
118
|
|
|
114
119
|
/**
|