@sasjs/core 4.49.0 → 4.50.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/base/mp_ds2csv.sas +10 -1
- package/package.json +1 -1
- package/xplatform/mx_getgroups.sas +83 -0
package/base/mp_ds2csv.sas
CHANGED
|
@@ -118,13 +118,21 @@ data _null_;
|
|
|
118
118
|
header = cats(coalescec(varlabel(dsid,i),varnm),dlm);
|
|
119
119
|
%end;
|
|
120
120
|
%else %if &headerformat=SASJS %then %do;
|
|
121
|
-
|
|
121
|
+
vlen=varlen(dsid,i);
|
|
122
|
+
if vartype(dsid,i)='C' then header=cats(varnm,':$char',vlen,'.');
|
|
122
123
|
else do;
|
|
123
124
|
vfmt=coalescec(varfmt(dsid,i),'0');
|
|
124
125
|
fmttype=mcf_getfmttype(vfmt);
|
|
125
126
|
if fmttype='DATE' then header=cats(varnm,':date9.');
|
|
126
127
|
else if fmttype='DATETIME' then header=cats(varnm,':E8601DT26.6');
|
|
127
128
|
else if fmttype='TIME' then header=cats(varnm,':TIME12.');
|
|
129
|
+
/**
|
|
130
|
+
* there is not much point importing a short length numeric like this,
|
|
131
|
+
* eg with best4., as the resulting variable will still be stored as
|
|
132
|
+
* length 8. We need a length or format statement to ensure variable
|
|
133
|
+
* is creatd with the smaller length...
|
|
134
|
+
**/
|
|
135
|
+
else if vlen<8 then header=cats(varnm,':best',vlen,'.');
|
|
128
136
|
else header=cats(varnm,':best.');
|
|
129
137
|
end;
|
|
130
138
|
%end;
|
|
@@ -151,6 +159,7 @@ data _null_;
|
|
|
151
159
|
set &ds end=last;
|
|
152
160
|
%do i=1 %to &vcnt;
|
|
153
161
|
%let var=%scan(&varlist,&i);
|
|
162
|
+
%local vlen&i;
|
|
154
163
|
%if %mf_getvartype(&ds,&var)=C %then %do;
|
|
155
164
|
%let dsv1=%mf_getuniquename(prefix=csvcol1_);
|
|
156
165
|
%let dsv2=%mf_getuniquename(prefix=csvcol2_);
|
package/package.json
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Fetches all groups or the groups for a particular member
|
|
4
|
+
@details When building applications that run on multiple flavours of SAS, it
|
|
5
|
+
is convenient to use a single macro (like this one) to fetch the groups
|
|
6
|
+
regardless of the flavour of SAS being used
|
|
7
|
+
|
|
8
|
+
The alternative would be to compile a generic macro in target-specific
|
|
9
|
+
folders (SASVIYA, SAS9 and SASJS). This avoids compiling unnecessary macros
|
|
10
|
+
at the expense of a more complex sasjsconfig.json setup.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
|
14
|
+
@param [in] user= (0) Provide the username on which to filter
|
|
15
|
+
@param [in] uid= (0) Provide the userid on which to filter
|
|
16
|
+
@param [in] repo= (foundation) SAS9 only, choose the metadata repo to query
|
|
17
|
+
@param [in] access_token_var= (ACCESS_TOKEN) VIYA only.
|
|
18
|
+
The global macro variable to contain the access token
|
|
19
|
+
@param [in] grant_type= (sas_services) VIYA only.
|
|
20
|
+
Valid values are "password" or "authorization_code" (unquoted).
|
|
21
|
+
@param [out] outds= (work.mx_getgroups) This output dataset will contain the
|
|
22
|
+
list of groups. Format:
|
|
23
|
+
|NAME:$32.|DESCRIPTION:$256.|GROUPID:best.|
|
|
24
|
+
|---|---|---|
|
|
25
|
+
|`SomeGroup `|`A group `|`1`|
|
|
26
|
+
|`Another Group`|`this is a different group`|`2`|
|
|
27
|
+
|`admin`|`Administrators `|`3`|
|
|
28
|
+
|
|
29
|
+
<h4> SAS Macros </h4>
|
|
30
|
+
@li mf_getplatform.sas
|
|
31
|
+
@li mm_getgroups.sas
|
|
32
|
+
@li ms_getgroups.sas
|
|
33
|
+
@li mv_getgroups.sas
|
|
34
|
+
@li mv_getusergroups.sas
|
|
35
|
+
|
|
36
|
+
**/
|
|
37
|
+
|
|
38
|
+
%macro mx_getgroups(
|
|
39
|
+
mdebug=0,
|
|
40
|
+
user=0,
|
|
41
|
+
uid=0,
|
|
42
|
+
repo=foundation,
|
|
43
|
+
access_token_var=ACCESS_TOKEN,
|
|
44
|
+
grant_type=sas_services,
|
|
45
|
+
outds=work.mx_getgroups
|
|
46
|
+
)/*/STORE SOURCE*/;
|
|
47
|
+
%local platform name shortloc;
|
|
48
|
+
%let platform=%mf_getplatform();
|
|
49
|
+
|
|
50
|
+
%if &platform=SASJS %then %do;
|
|
51
|
+
%ms_getgroups(
|
|
52
|
+
user=&user,
|
|
53
|
+
uid=&uid,
|
|
54
|
+
outds=&outds,
|
|
55
|
+
mdebug=&mdebug
|
|
56
|
+
)
|
|
57
|
+
%end;
|
|
58
|
+
%else %if &platform=SAS9 or &platform=SASMETA %then %do;
|
|
59
|
+
%if &user=0 %then %let user=;
|
|
60
|
+
%mm_getGroups(
|
|
61
|
+
user=&user
|
|
62
|
+
,outds=&outds
|
|
63
|
+
,repo=&repo
|
|
64
|
+
,mDebug=&mdebug
|
|
65
|
+
)
|
|
66
|
+
%end;
|
|
67
|
+
%else %if &platform=SASVIYA %then %do;
|
|
68
|
+
%if &user=0 %then %do;
|
|
69
|
+
%mv_getgroups(access_token_var=&access_token_var
|
|
70
|
+
,grant_type=&grant_type
|
|
71
|
+
,outds=&outds
|
|
72
|
+
)
|
|
73
|
+
%end;
|
|
74
|
+
%else %do;
|
|
75
|
+
%mv_getusergroups(&user
|
|
76
|
+
,outds=&outds
|
|
77
|
+
,access_token_var=&access_token_var
|
|
78
|
+
,grant_type=&grant_type
|
|
79
|
+
)
|
|
80
|
+
%end;
|
|
81
|
+
%end;
|
|
82
|
+
|
|
83
|
+
%mend mx_getgroups;
|