@sasjs/core 3.7.2 → 3.7.3
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/base/mp_getcols.sas +18 -16
- package/package.json +2 -2
package/base/mp_getcols.sas
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
@param ds The dataset from which to obtain column metadata
|
|
16
16
|
@param outds= (work.cols) The output dataset to create. Sample data:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
|NAME:$32.|LENGTH:best.|VARNUM:best.|LABEL:$256.|FMTNAME:$32.|FORMAT:$49.|TYPE:$1.|DDTYPE:$9.|
|
|
18
|
+
|---|---|---|---|---|---|---|---|
|
|
19
|
+
|`AIR `|`8 `|`2 `|`international airline travel (thousands) `|` `|`8. `|`N `|`NUMERIC `|
|
|
20
|
+
|`DATE `|`8 `|`1 `|`DATE `|`MONYY `|`MONYY. `|`N `|`DATE `|
|
|
21
|
+
|`REGION `|`3 `|`3 `|`REGION `|` `|`$3. `|`C `|`CHARACTER `|
|
|
22
22
|
|
|
23
23
|
<h4> Related Macros </h4>
|
|
24
24
|
@li mf_getvarlist.sas
|
|
@@ -30,26 +30,27 @@
|
|
|
30
30
|
**/
|
|
31
31
|
|
|
32
32
|
%macro mp_getcols(ds, outds=work.cols);
|
|
33
|
-
|
|
33
|
+
%local dropds;
|
|
34
34
|
proc contents noprint data=&ds
|
|
35
35
|
out=_data_ (keep=name type length label varnum format:);
|
|
36
36
|
run;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
%let dropds=&syslast;
|
|
38
|
+
data &outds(keep=name type length varnum format label ddtype fmtname);
|
|
39
|
+
set &dropds(rename=(format=fmtname type=type2));
|
|
39
40
|
name=upcase(name);
|
|
40
41
|
if type2=2 then do;
|
|
41
42
|
length format $49.;
|
|
42
|
-
if
|
|
43
|
-
else if formatl=0 then format=cats(
|
|
44
|
-
else format=cats(
|
|
43
|
+
if fmtname='' then format=cats('$',length,'.');
|
|
44
|
+
else if formatl=0 then format=cats(fmtname,'.');
|
|
45
|
+
else format=cats(fmtname,formatl,'.');
|
|
45
46
|
type='C';
|
|
46
47
|
ddtype='CHARACTER';
|
|
47
48
|
end;
|
|
48
49
|
else do;
|
|
49
|
-
if
|
|
50
|
-
else if formatl=0 then format=cats(
|
|
51
|
-
else if formatd=0 then format=cats(
|
|
52
|
-
else format=cats(
|
|
50
|
+
if fmtname='' then format=cats(length,'.');
|
|
51
|
+
else if formatl=0 then format=cats(fmtname,'.');
|
|
52
|
+
else if formatd=0 then format=cats(fmtname,formatl,'.');
|
|
53
|
+
else format=cats(fmtname,formatl,'.',formatd);
|
|
53
54
|
type='N';
|
|
54
55
|
if format=:'DATETIME' or format=:'E8601DT' then ddtype='DATETIME';
|
|
55
56
|
else if format=:'DATE' or format=:'DDMMYY' or format=:'MMDDYY'
|
|
@@ -61,5 +62,6 @@ data &outds(keep=name type length varnum format label ddtype);
|
|
|
61
62
|
end;
|
|
62
63
|
if label='' then label=name;
|
|
63
64
|
run;
|
|
64
|
-
|
|
65
|
+
proc sql;
|
|
66
|
+
drop table &dropds;
|
|
65
67
|
%mend mp_getcols;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/core",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Macros for SAS Application Developers",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"SAS",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"ts-loader": "^9.2.6"
|
|
40
40
|
},
|
|
41
|
-
"version": "3.7.
|
|
41
|
+
"version": "3.7.3"
|
|
42
42
|
}
|