@sasjs/core 4.48.2 → 4.48.4
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 +4 -1
- package/base/mf_isblank.sas +1 -1
- package/base/mp_cntlout.sas +2 -2
- package/base/mp_loadformat.sas +34 -14
- package/ddl/mddl_sas_cntlout.sas +22 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -248,7 +248,7 @@ The following repositories are also worth checking out:
|
|
|
248
248
|
|
|
249
249
|
## Contributors ✨
|
|
250
250
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
251
|
-
[](#contributors-)
|
|
252
252
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
253
253
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
254
254
|
|
|
@@ -275,6 +275,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
275
275
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/henrik-forsell"><img src="https://avatars.githubusercontent.com/u/109935936?v=4?s=100" width="100px;" alt="Henrik Forsell"/><br /><sub><b>Henrik Forsell</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=henrik-forsell" title="Documentation">📖</a></td>
|
|
276
276
|
<td align="center" valign="top" width="14.28%"><a href="http://rudvfaden.github.io/"><img src="https://avatars.githubusercontent.com/u/2445577?v=4?s=100" width="100px;" alt="Rud Faden"/><br /><sub><b>Rud Faden</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=rudvfaden" title="Code">💻</a></td>
|
|
277
277
|
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andyjessen"><img src="https://avatars.githubusercontent.com/u/62343929?v=4?s=100" width="100px;" alt="andyjessen"/><br /><sub><b>andyjessen</b></sub></a><br /><a href="https://github.com/sasjs/core/commits?author=andyjessen" title="Documentation">📖</a></td>
|
|
280
|
+
</tr>
|
|
278
281
|
</tbody>
|
|
279
282
|
</table>
|
|
280
283
|
|
package/base/mf_isblank.sas
CHANGED
package/base/mp_cntlout.sas
CHANGED
package/base/mp_loadformat.sas
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
format, to prevent loss of data - UNLESS the input dataset contains a marker
|
|
10
10
|
column, specifying that a particular row needs to be deleted (`delete_col=`).
|
|
11
11
|
|
|
12
|
+
Positions of formats are made using the FMTROW variable - this must be present
|
|
13
|
+
and unique (on TYPE / FMTNAME / FMTROW).
|
|
14
|
+
|
|
12
15
|
This macro can also be used to identify which records would be (or were)
|
|
13
16
|
considered new, modified or deleted (`loadtarget=`) by creating the following
|
|
14
17
|
tables:
|
|
@@ -17,7 +20,7 @@
|
|
|
17
20
|
@li work.outds_del
|
|
18
21
|
@li work.outds_mod
|
|
19
22
|
|
|
20
|
-
For example usage, see
|
|
23
|
+
For example usage, see test (under Related Macros)
|
|
21
24
|
|
|
22
25
|
@param [in] libcat The format catalog to be loaded
|
|
23
26
|
@param [in] libds The staging table to load
|
|
@@ -34,12 +37,15 @@
|
|
|
34
37
|
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages and preserve outputs
|
|
35
38
|
|
|
36
39
|
<h4> SAS Macros </h4>
|
|
40
|
+
@li mf_existds.sas
|
|
41
|
+
@li mf_existvar.sas
|
|
37
42
|
@li mf_getuniquename.sas
|
|
38
43
|
@li mf_nobs.sas
|
|
39
44
|
@li mp_abort.sas
|
|
40
45
|
@li mp_aligndecimal.sas
|
|
41
46
|
@li mp_cntlout.sas
|
|
42
47
|
@li mp_lockanytable.sas
|
|
48
|
+
@li mp_md5.sas
|
|
43
49
|
@li mp_storediffs.sas
|
|
44
50
|
|
|
45
51
|
<h4> Related Macros </h4>
|
|
@@ -83,6 +89,16 @@
|
|
|
83
89
|
%let libcat=%scan(&libcat,1,-);
|
|
84
90
|
|
|
85
91
|
/* perform input validations */
|
|
92
|
+
%mp_abort(
|
|
93
|
+
iftrue=(%mf_existds(&libds)=0)
|
|
94
|
+
,mac=&sysmacroname
|
|
95
|
+
,msg=%str(&libds could not be found)
|
|
96
|
+
)
|
|
97
|
+
%mp_abort(
|
|
98
|
+
iftrue=(%mf_existvar(&libds,FMTROW)=0)
|
|
99
|
+
,mac=&sysmacroname
|
|
100
|
+
,msg=%str(FMTROW not found in &libds)
|
|
101
|
+
)
|
|
86
102
|
%let err=0;
|
|
87
103
|
%let msg=0;
|
|
88
104
|
data _null_;
|
|
@@ -103,13 +119,6 @@ data _null_;
|
|
|
103
119
|
stop;
|
|
104
120
|
end;
|
|
105
121
|
end;
|
|
106
|
-
else if name='LIBDS' then do;
|
|
107
|
-
if exist(value) le 0 then do;
|
|
108
|
-
call symputx('msg',"Unable to open staging table: "!!value);
|
|
109
|
-
call symputx('err',1);
|
|
110
|
-
stop;
|
|
111
|
-
end;
|
|
112
|
-
end;
|
|
113
122
|
else if (name=:'OUTDS' or name in ('DELETE_COL','LOCKLIBDS','AUDITLIBDS'))
|
|
114
123
|
and missing(value) then do;
|
|
115
124
|
call symputx('msg',"missing value in var: "!!name);
|
|
@@ -117,6 +126,14 @@ data _null_;
|
|
|
117
126
|
stop;
|
|
118
127
|
end;
|
|
119
128
|
run;
|
|
129
|
+
data _null_;
|
|
130
|
+
set &libds;
|
|
131
|
+
if missing(fmtrow) then do;
|
|
132
|
+
call symputx('msg',"missing fmtrow in format: "!!FMTNAME);
|
|
133
|
+
call symputx('err',1);
|
|
134
|
+
stop;
|
|
135
|
+
end;
|
|
136
|
+
run;
|
|
120
137
|
|
|
121
138
|
%mp_abort(
|
|
122
139
|
iftrue=(&err ne 0)
|
|
@@ -124,6 +141,15 @@ run;
|
|
|
124
141
|
,msg=%str(&msg)
|
|
125
142
|
)
|
|
126
143
|
|
|
144
|
+
%local cnt;
|
|
145
|
+
proc sql noprint;
|
|
146
|
+
select count(distinct catx('|',type,fmtname,fmtrow)) into: cnt from &libds;
|
|
147
|
+
%mp_abort(
|
|
148
|
+
iftrue=(&cnt ne %mf_nobs(&libds))
|
|
149
|
+
,mac=&sysmacroname
|
|
150
|
+
,msg=%str(Non-unique primary key on &libds)
|
|
151
|
+
)
|
|
152
|
+
|
|
127
153
|
/**
|
|
128
154
|
* First, extract only relevant formats from the catalog
|
|
129
155
|
*/
|
|
@@ -177,12 +203,6 @@ data &inlibds/nonote2err;
|
|
|
177
203
|
%mp_aligndecimal(end,width=16)
|
|
178
204
|
end;
|
|
179
205
|
|
|
180
|
-
/* update row marker - retain new var as fmtrow may already be in libds */
|
|
181
|
-
if first.fmtname then row=1;
|
|
182
|
-
else row+1;
|
|
183
|
-
drop row;
|
|
184
|
-
fmtrow=row;
|
|
185
|
-
|
|
186
206
|
fmthash=%mp_md5(cvars=&cvars, nvars=&nvars);
|
|
187
207
|
run;
|
|
188
208
|
|
package/ddl/mddl_sas_cntlout.sas
CHANGED
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
(given various practical restrictions) are described here to enable
|
|
7
7
|
consistency when dealing with format data.
|
|
8
8
|
|
|
9
|
+
The HLO variable may have a number of values, documented here due to the
|
|
10
|
+
256 char label description length limit:
|
|
11
|
+
|
|
12
|
+
F=Standard format/informat.
|
|
13
|
+
H=Range ending value is HIGH.
|
|
14
|
+
I=Numeric informat.
|
|
15
|
+
J=Justification for an informat.
|
|
16
|
+
L=Range starting value is LOW.
|
|
17
|
+
M=MultiLabel.
|
|
18
|
+
N=Format or informat has no ranges, including no OTHER= range.
|
|
19
|
+
O=Range is OTHER.
|
|
20
|
+
R=ROUND option is in effect.
|
|
21
|
+
S=Specifies that NOTSORTED is in effect.
|
|
22
|
+
U=Specifies that the UPCASE option for an informat be used.
|
|
23
|
+
|
|
24
|
+
|
|
9
25
|
**/
|
|
10
26
|
|
|
11
27
|
|
|
@@ -13,9 +29,11 @@
|
|
|
13
29
|
|
|
14
30
|
proc sql;
|
|
15
31
|
create table &libds(
|
|
16
|
-
TYPE char(1) label=
|
|
32
|
+
TYPE char(1) label=
|
|
33
|
+
'Format Type: either N (num fmt), C (char fmt), I (num infmt) or J (char infmt)'
|
|
17
34
|
,FMTNAME char(32) label='Format name'
|
|
18
|
-
,FMTROW num label=
|
|
35
|
+
,FMTROW num label=
|
|
36
|
+
'CALCULATED Position of record by FMTNAME (reqd for multilabel formats)'
|
|
19
37
|
,START char(32767) label='Starting value for format'
|
|
20
38
|
/*
|
|
21
39
|
Keep lengths of START and END the same to avoid this err:
|
|
@@ -35,18 +53,8 @@
|
|
|
35
53
|
,NOEDIT num length=3 label='Is picture string noedit?'
|
|
36
54
|
,SEXCL char(1) label='Start exclusion'
|
|
37
55
|
,EEXCL char(1) label='End exclusion'
|
|
38
|
-
,HLO char(13)
|
|
39
|
-
|
|
40
|
-
H=Range ending value is HIGH.
|
|
41
|
-
I=Numeric informat.
|
|
42
|
-
J=Justification for an informat.
|
|
43
|
-
L=Range starting value is LOW.
|
|
44
|
-
M=MultiLabel.
|
|
45
|
-
N=Format or informat has no ranges, including no OTHER= range.
|
|
46
|
-
O=Range is OTHER.
|
|
47
|
-
R=ROUND option is in effect.
|
|
48
|
-
S=Specifies that NOTSORTED is in effect.
|
|
49
|
-
U=Specifies that the UPCASE option for an informat be used.'
|
|
56
|
+
,HLO char(13) label=
|
|
57
|
+
'More info: https://core.sasjs.io/mddl__sas__cntlout_8sas_source.html'
|
|
50
58
|
,DECSEP char(1) label='Decimal separator'
|
|
51
59
|
,DIG3SEP char(1) label='Three-digit separator'
|
|
52
60
|
,DATATYPE char(8) label='Date/time/datetime?'
|
package/package.json
CHANGED