@sasjs/core 4.48.3 → 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 +33 -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,6 +37,8 @@
|
|
|
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
|
|
@@ -84,6 +89,16 @@
|
|
|
84
89
|
%let libcat=%scan(&libcat,1,-);
|
|
85
90
|
|
|
86
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
|
+
)
|
|
87
102
|
%let err=0;
|
|
88
103
|
%let msg=0;
|
|
89
104
|
data _null_;
|
|
@@ -104,13 +119,6 @@ data _null_;
|
|
|
104
119
|
stop;
|
|
105
120
|
end;
|
|
106
121
|
end;
|
|
107
|
-
else if name='LIBDS' then do;
|
|
108
|
-
if exist(value) le 0 then do;
|
|
109
|
-
call symputx('msg',"Unable to open staging table: "!!value);
|
|
110
|
-
call symputx('err',1);
|
|
111
|
-
stop;
|
|
112
|
-
end;
|
|
113
|
-
end;
|
|
114
122
|
else if (name=:'OUTDS' or name in ('DELETE_COL','LOCKLIBDS','AUDITLIBDS'))
|
|
115
123
|
and missing(value) then do;
|
|
116
124
|
call symputx('msg',"missing value in var: "!!name);
|
|
@@ -118,6 +126,14 @@ data _null_;
|
|
|
118
126
|
stop;
|
|
119
127
|
end;
|
|
120
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;
|
|
121
137
|
|
|
122
138
|
%mp_abort(
|
|
123
139
|
iftrue=(&err ne 0)
|
|
@@ -125,6 +141,15 @@ run;
|
|
|
125
141
|
,msg=%str(&msg)
|
|
126
142
|
)
|
|
127
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
|
+
|
|
128
153
|
/**
|
|
129
154
|
* First, extract only relevant formats from the catalog
|
|
130
155
|
*/
|
|
@@ -178,12 +203,6 @@ data &inlibds/nonote2err;
|
|
|
178
203
|
%mp_aligndecimal(end,width=16)
|
|
179
204
|
end;
|
|
180
205
|
|
|
181
|
-
/* update row marker - retain new var as fmtrow may already be in libds */
|
|
182
|
-
if first.fmtname then row=1;
|
|
183
|
-
else row+1;
|
|
184
|
-
drop row;
|
|
185
|
-
fmtrow=row;
|
|
186
|
-
|
|
187
206
|
fmthash=%mp_md5(cvars=&cvars, nvars=&nvars);
|
|
188
207
|
run;
|
|
189
208
|
|
package/package.json
CHANGED