@sasjs/core 4.27.3 → 4.27.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/meta/mm_createdataset.sas +24 -16
- package/package.json +1 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@file
|
|
3
|
-
@brief Create
|
|
2
|
+
@file
|
|
3
|
+
@brief Create an empty dataset from a metadata definition
|
|
4
4
|
@details This macro was built to support viewing empty tables in
|
|
5
|
-
|
|
6
|
-
contacting the author (Allan Bowe).
|
|
5
|
+
https://datacontroller.io
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
The table can be retrieved using LIBRARY.DATASET reference, or directly
|
|
8
|
+
using the metadata URI.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
The dataset is written to the WORK library.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
Usage:
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
%mm_createdataset(libds=metlib.some_dataset)
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
or
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
%mm_createdataset(tableuri=G5X8AFW1.BE00015Y)
|
|
20
19
|
|
|
21
20
|
<h4> SAS Macros </h4>
|
|
22
21
|
@li mm_getlibs.sas
|
|
@@ -26,9 +25,9 @@
|
|
|
26
25
|
@param libds= library.dataset metadata source. Note - table names in metadata
|
|
27
26
|
can be longer than 32 chars (just fyi, not an issue here)
|
|
28
27
|
@param tableuri= Metadata URI of the table to be created
|
|
29
|
-
@param outds= The dataset to create
|
|
30
|
-
|
|
31
|
-
@param mdebug=
|
|
28
|
+
@param outds= (work.mm_createdataset) The dataset to create. The table name
|
|
29
|
+
needs to be 32 chars or less as per SAS naming rules.
|
|
30
|
+
@param mdebug= (0) Set to 1 to enable DEBUG messages
|
|
32
31
|
|
|
33
32
|
@version 9.4
|
|
34
33
|
@author Allan Bowe
|
|
@@ -54,14 +53,23 @@
|
|
|
54
53
|
%mm_gettables(uri=&liburi,outds=&tempds2)
|
|
55
54
|
data _null_;
|
|
56
55
|
set &tempds2;
|
|
57
|
-
|
|
56
|
+
where upcase(tablename)="%upcase(%scan(&libds,2,.))";
|
|
57
|
+
&dbg putlog tableuri=;
|
|
58
58
|
call symputx('tableuri',tableuri);
|
|
59
59
|
run;
|
|
60
60
|
%end;
|
|
61
61
|
|
|
62
|
-
data;run
|
|
62
|
+
data;run;
|
|
63
|
+
%let tempds3=&syslast;
|
|
63
64
|
%mm_getcols(tableuri=&tableuri,outds=&tempds3)
|
|
64
65
|
|
|
66
|
+
%if %mf_nobs(&tempds3)=0 %then %do;
|
|
67
|
+
%put &libds (&tableuri) has no columns defined!!;
|
|
68
|
+
data &outds;
|
|
69
|
+
run;
|
|
70
|
+
%return;
|
|
71
|
+
%end;
|
|
72
|
+
|
|
65
73
|
data _null_;
|
|
66
74
|
set &tempds3 end=last;
|
|
67
75
|
if _n_=1 then call execute('data &outds;');
|
package/package.json
CHANGED