@sasjs/core 4.32.15 → 4.33.2
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
CHANGED
|
@@ -237,6 +237,7 @@ If you find this library useful, please leave a [star](https://github.com/sasjs/
|
|
|
237
237
|
|
|
238
238
|
The following repositories are also worth checking out:
|
|
239
239
|
|
|
240
|
+
* [SASJedi/sas-macros](https://github.com/SASJedi/sas-macros)
|
|
240
241
|
* [chris-swenson/sasmacros](https://github.com/chris-swenson/sasmacros)
|
|
241
242
|
* [greg-wotton/sas-programs](https://github.com/greg-wootton/sas-programs)
|
|
242
243
|
* [KatjaGlassConsulting/SMILE-SmartSASMacros](https://github.com/KatjaGlassConsulting/SMILE-SmartSASMacros)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Increments a macro variable
|
|
4
|
+
@details Useful outside of do-loops - will increment a macro variable every
|
|
5
|
+
time it is called.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
%let cnt=1;
|
|
10
|
+
%put We have run %mf_increment(cnt) lines;
|
|
11
|
+
%put Now we have run %mf_increment(cnt) lines;
|
|
12
|
+
%put There are %mf_increment(cnt) lines in total;
|
|
13
|
+
|
|
14
|
+
@param [in] MACRO_NAME the name of the macro variable to increment
|
|
15
|
+
@param [in] ITER= The amount to add or subtract to the macro
|
|
16
|
+
|
|
17
|
+
<h4> Related Files </h4>
|
|
18
|
+
@li mf_increment.test.sas
|
|
19
|
+
|
|
20
|
+
**/
|
|
21
|
+
|
|
22
|
+
%macro mf_increment(macro_name,incr=1);
|
|
23
|
+
|
|
24
|
+
/* iterate the value */
|
|
25
|
+
%let ¯o_name=%eval(&&¯o_name+&incr);
|
|
26
|
+
/* return the value */
|
|
27
|
+
&&¯o_name
|
|
28
|
+
|
|
29
|
+
%mend mf_increment;
|
package/base/mp_getddl.sas
CHANGED
|
@@ -130,13 +130,13 @@ run;
|
|
|
130
130
|
|
|
131
131
|
%local x curds;
|
|
132
132
|
%if &flavour=SAS %then %do;
|
|
133
|
-
data _null_;
|
|
134
|
-
file &fref mod;
|
|
135
|
-
put "/* SAS Flavour DDL for %upcase(&libref).&curds */";
|
|
136
|
-
put "proc sql;";
|
|
137
|
-
run;
|
|
138
133
|
%do x=1 %to %sysfunc(countw(&dsnlist));
|
|
139
134
|
%let curds=%scan(&dsnlist,&x);
|
|
135
|
+
data _null_;
|
|
136
|
+
file &fref mod;
|
|
137
|
+
put "/* SAS Flavour DDL for %upcase(&libref).&curds */";
|
|
138
|
+
put "proc sql;";
|
|
139
|
+
run;
|
|
140
140
|
data _null_;
|
|
141
141
|
file &fref mod;
|
|
142
142
|
length lab $1024 typ $20;
|
package/base/mp_jsonout.sas
CHANGED
|
@@ -126,7 +126,6 @@
|
|
|
126
126
|
if format='' then fmt=cats('$',length,'.');
|
|
127
127
|
else if formatl=0 then fmt=cats(format,'.');
|
|
128
128
|
else fmt=cats(format,formatl,'.');
|
|
129
|
-
newlen=max(formatl,length);
|
|
130
129
|
end;
|
|
131
130
|
else do;
|
|
132
131
|
typelong='num';
|
|
@@ -134,15 +133,12 @@
|
|
|
134
133
|
else if formatl=0 then fmt=cats(format,'.');
|
|
135
134
|
else if formatd=0 then fmt=cats(format,formatl,'.');
|
|
136
135
|
else fmt=cats(format,formatl,'.',formatd);
|
|
137
|
-
/* needs to be wide, for datetimes etc */
|
|
138
|
-
newlen=max(length,formatl,24);
|
|
139
136
|
end;
|
|
140
137
|
/* 32 char unique name */
|
|
141
138
|
newname='sasjs'!!substr(cats(put(md5(name),$hex32.)),1,27);
|
|
142
139
|
|
|
143
140
|
call symputx(cats('name',_n_),name,'l');
|
|
144
141
|
call symputx(cats('newname',_n_),newname,'l');
|
|
145
|
-
call symputx(cats('len',_n_),newlen,'l');
|
|
146
142
|
call symputx(cats('length',_n_),length,'l');
|
|
147
143
|
call symputx(cats('fmt',_n_),fmt,'l');
|
|
148
144
|
call symputx(cats('type',_n_),type,'l');
|
|
@@ -195,7 +191,8 @@
|
|
|
195
191
|
%end;
|
|
196
192
|
));
|
|
197
193
|
%do i=1 %to &numcols;
|
|
198
|
-
length
|
|
194
|
+
/* formatted values can be up to length 32767 */
|
|
195
|
+
length &&name&i $32767;
|
|
199
196
|
%if &&typelong&i=num %then %do;
|
|
200
197
|
&&name&i=left(put(&&newname&i,&&fmt&i));
|
|
201
198
|
%end;
|
|
@@ -149,7 +149,6 @@ data _null_;
|
|
|
149
149
|
put ' if format='''' then fmt=cats(''$'',length,''.''); ';
|
|
150
150
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
151
151
|
put ' else fmt=cats(format,formatl,''.''); ';
|
|
152
|
-
put ' newlen=max(formatl,length); ';
|
|
153
152
|
put ' end; ';
|
|
154
153
|
put ' else do; ';
|
|
155
154
|
put ' typelong=''num''; ';
|
|
@@ -157,15 +156,12 @@ data _null_;
|
|
|
157
156
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
158
157
|
put ' else if formatd=0 then fmt=cats(format,formatl,''.''); ';
|
|
159
158
|
put ' else fmt=cats(format,formatl,''.'',formatd); ';
|
|
160
|
-
put ' /* needs to be wide, for datetimes etc */ ';
|
|
161
|
-
put ' newlen=max(length,formatl,24); ';
|
|
162
159
|
put ' end; ';
|
|
163
160
|
put ' /* 32 char unique name */ ';
|
|
164
161
|
put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
|
|
165
162
|
put ' ';
|
|
166
163
|
put ' call symputx(cats(''name'',_n_),name,''l''); ';
|
|
167
164
|
put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
|
|
168
|
-
put ' call symputx(cats(''len'',_n_),newlen,''l''); ';
|
|
169
165
|
put ' call symputx(cats(''length'',_n_),length,''l''); ';
|
|
170
166
|
put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
|
|
171
167
|
put ' call symputx(cats(''type'',_n_),type,''l''); ';
|
|
@@ -218,7 +214,8 @@ data _null_;
|
|
|
218
214
|
put ' %end; ';
|
|
219
215
|
put ' )); ';
|
|
220
216
|
put ' %do i=1 %to &numcols; ';
|
|
221
|
-
put ' length
|
|
217
|
+
put ' /* formatted values can be up to length 32767 */ ';
|
|
218
|
+
put ' length &&name&i $32767; ';
|
|
222
219
|
put ' %if &&typelong&i=num %then %do; ';
|
|
223
220
|
put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
|
|
224
221
|
put ' %end; ';
|
package/package.json
CHANGED
|
@@ -150,7 +150,6 @@ data _null_;
|
|
|
150
150
|
put ' if format='''' then fmt=cats(''$'',length,''.''); ';
|
|
151
151
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
152
152
|
put ' else fmt=cats(format,formatl,''.''); ';
|
|
153
|
-
put ' newlen=max(formatl,length); ';
|
|
154
153
|
put ' end; ';
|
|
155
154
|
put ' else do; ';
|
|
156
155
|
put ' typelong=''num''; ';
|
|
@@ -158,15 +157,12 @@ data _null_;
|
|
|
158
157
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
159
158
|
put ' else if formatd=0 then fmt=cats(format,formatl,''.''); ';
|
|
160
159
|
put ' else fmt=cats(format,formatl,''.'',formatd); ';
|
|
161
|
-
put ' /* needs to be wide, for datetimes etc */ ';
|
|
162
|
-
put ' newlen=max(length,formatl,24); ';
|
|
163
160
|
put ' end; ';
|
|
164
161
|
put ' /* 32 char unique name */ ';
|
|
165
162
|
put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
|
|
166
163
|
put ' ';
|
|
167
164
|
put ' call symputx(cats(''name'',_n_),name,''l''); ';
|
|
168
165
|
put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
|
|
169
|
-
put ' call symputx(cats(''len'',_n_),newlen,''l''); ';
|
|
170
166
|
put ' call symputx(cats(''length'',_n_),length,''l''); ';
|
|
171
167
|
put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
|
|
172
168
|
put ' call symputx(cats(''type'',_n_),type,''l''); ';
|
|
@@ -219,7 +215,8 @@ data _null_;
|
|
|
219
215
|
put ' %end; ';
|
|
220
216
|
put ' )); ';
|
|
221
217
|
put ' %do i=1 %to &numcols; ';
|
|
222
|
-
put ' length
|
|
218
|
+
put ' /* formatted values can be up to length 32767 */ ';
|
|
219
|
+
put ' length &&name&i $32767; ';
|
|
223
220
|
put ' %if &&typelong&i=num %then %do; ';
|
|
224
221
|
put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
|
|
225
222
|
put ' %end; ';
|
|
@@ -292,7 +292,6 @@ data _null_;
|
|
|
292
292
|
put ' if format='''' then fmt=cats(''$'',length,''.''); ';
|
|
293
293
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
294
294
|
put ' else fmt=cats(format,formatl,''.''); ';
|
|
295
|
-
put ' newlen=max(formatl,length); ';
|
|
296
295
|
put ' end; ';
|
|
297
296
|
put ' else do; ';
|
|
298
297
|
put ' typelong=''num''; ';
|
|
@@ -300,15 +299,12 @@ data _null_;
|
|
|
300
299
|
put ' else if formatl=0 then fmt=cats(format,''.''); ';
|
|
301
300
|
put ' else if formatd=0 then fmt=cats(format,formatl,''.''); ';
|
|
302
301
|
put ' else fmt=cats(format,formatl,''.'',formatd); ';
|
|
303
|
-
put ' /* needs to be wide, for datetimes etc */ ';
|
|
304
|
-
put ' newlen=max(length,formatl,24); ';
|
|
305
302
|
put ' end; ';
|
|
306
303
|
put ' /* 32 char unique name */ ';
|
|
307
304
|
put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
|
|
308
305
|
put ' ';
|
|
309
306
|
put ' call symputx(cats(''name'',_n_),name,''l''); ';
|
|
310
307
|
put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
|
|
311
|
-
put ' call symputx(cats(''len'',_n_),newlen,''l''); ';
|
|
312
308
|
put ' call symputx(cats(''length'',_n_),length,''l''); ';
|
|
313
309
|
put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
|
|
314
310
|
put ' call symputx(cats(''type'',_n_),type,''l''); ';
|
|
@@ -361,7 +357,8 @@ data _null_;
|
|
|
361
357
|
put ' %end; ';
|
|
362
358
|
put ' )); ';
|
|
363
359
|
put ' %do i=1 %to &numcols; ';
|
|
364
|
-
put ' length
|
|
360
|
+
put ' /* formatted values can be up to length 32767 */ ';
|
|
361
|
+
put ' length &&name&i $32767; ';
|
|
365
362
|
put ' %if &&typelong&i=num %then %do; ';
|
|
366
363
|
put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
|
|
367
364
|
put ' %end; ';
|