@sasjs/core 3.8.0 → 3.9.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.
@@ -54,9 +54,9 @@
54
54
  that location
55
55
  @param [in] adapter= the macro uses the sasjs adapter by default. To use
56
56
  another adapter, add a (different) fileref here.
57
- @param [in] contextname= Choose a specific context on which to run the Job. Leave
58
- blank to use the default context. From Viya 3.5 it is possible to configure
59
- a shared context - see
57
+ @param [in] contextname= Choose a specific context on which to run the Job.
58
+ Leave blank to use the default context. From Viya 3.5 it is possible to
59
+ configure a shared context - see
60
60
  https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en
61
61
  @param [in] mdebug=(0) set to 1 to enable DEBUG messages
62
62
 
@@ -237,10 +237,15 @@ data _null_;
237
237
  put "/* Created on %sysfunc(datetime(),datetime19.) by &sysuserid */";
238
238
  /* WEBOUT BEGIN */
239
239
  put ' ';
240
- put '%macro mp_jsonout(action,ds,jref=_webout,dslabel=,fmt=Y,engine=DATASTEP,dbg=0 ';
240
+ put '%macro mp_jsonout(action,ds,jref=_webout,dslabel=,fmt=Y ';
241
+ put ' ,engine=DATASTEP ';
242
+ put ' ,dbg=0 /* DEPRECATED */ ';
241
243
  put ' ,missing=NULL ';
244
+ put ' ,showmeta=NO ';
242
245
  put ')/*/STORE SOURCE*/; ';
243
- put '%put &sysmacroname: output location=&jref; ';
246
+ put '%local tempds colinfo fmtds i numcols; ';
247
+ put '%let numcols=0; ';
248
+ put ' ';
244
249
  put '%if &action=OPEN %then %do; ';
245
250
  put ' options nobomfile; ';
246
251
  put ' data _null_;file &jref encoding=''utf-8'' ; ';
@@ -249,17 +254,61 @@ data _null_;
249
254
  put '%end; ';
250
255
  put '%else %if (&action=ARR or &action=OBJ) %then %do; ';
251
256
  put ' options validvarname=upcase; ';
252
- put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
257
+ put ' data _null_; file &jref encoding=''utf-8'' mod; ';
253
258
  put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
254
259
  put ' ';
260
+ put ' /* grab col defs */ ';
261
+ put ' proc contents noprint data=&ds ';
262
+ put ' out=_data_(keep=name type length format formatl formatd varnum label); ';
263
+ put ' run; ';
264
+ put ' %let colinfo=%scan(&syslast,2,.); ';
265
+ put ' proc sort data=&colinfo; ';
266
+ put ' by varnum; ';
267
+ put ' run; ';
268
+ put ' /* move meta to mac vars */ ';
269
+ put ' data _null_; ';
270
+ put ' if _n_=1 then call symputx(''numcols'',nobs,''l''); ';
271
+ put ' set &colinfo end=last nobs=nobs; ';
272
+ put ' name=upcase(name); ';
273
+ put ' /* fix formats */ ';
274
+ put ' if type=2 or type=6 then do; ';
275
+ put ' typelong=''char''; ';
276
+ put ' length fmt $49.; ';
277
+ put ' if format='''' then fmt=cats(''$'',length,''.''); ';
278
+ put ' else if formatl=0 then fmt=cats(format,''.''); ';
279
+ put ' else fmt=cats(format,formatl,''.''); ';
280
+ put ' newlen=max(formatl,length); ';
281
+ put ' end; ';
282
+ put ' else do; ';
283
+ put ' typelong=''num''; ';
284
+ put ' if format='''' then fmt=''best.''; ';
285
+ put ' else if formatl=0 then fmt=cats(format,''.''); ';
286
+ put ' else if formatd=0 then fmt=cats(format,formatl,''.''); ';
287
+ put ' else fmt=cats(format,formatl,''.'',formatd); ';
288
+ put ' /* needs to be wide, for datetimes etc */ ';
289
+ put ' newlen=max(length,formatl,24); ';
290
+ put ' end; ';
291
+ put ' /* 32 char unique name */ ';
292
+ put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
293
+ put ' ';
294
+ put ' call symputx(cats(''name'',_n_),name,''l''); ';
295
+ put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
296
+ put ' call symputx(cats(''len'',_n_),newlen,''l''); ';
297
+ put ' call symputx(cats(''length'',_n_),length,''l''); ';
298
+ put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
299
+ put ' call symputx(cats(''type'',_n_),type,''l''); ';
300
+ put ' call symputx(cats(''typelong'',_n_),typelong,''l''); ';
301
+ put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
302
+ put ' run; ';
303
+ put ' ';
304
+ put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
305
+ put ' ';
255
306
  put ' %if &engine=PROCJSON %then %do; ';
256
307
  put ' %if &missing=STRING %then %do; ';
257
- put ' %put &sysmacroname: Special Missings are not supported in proc json.; ';
308
+ put ' %put &sysmacroname: Special Missings not supported in proc json.; ';
258
309
  put ' %put &sysmacroname: Switching to DATASTEP engine; ';
259
310
  put ' %goto datastep; ';
260
311
  put ' %end; ';
261
- put ' data;run;%let tempds=&syslast; ';
262
- put ' proc sql;drop table &tempds; ';
263
312
  put ' data &tempds /view=&tempds;set &ds; ';
264
313
  put ' %if &fmt=N %then format _numeric_ best32.;; ';
265
314
  put ' /* PRETTY is necessary to avoid line truncation in large files */ ';
@@ -267,91 +316,35 @@ data _null_;
267
316
  put ' %if &action=ARR %then nokeys ; ';
268
317
  put ' ;export &tempds / nosastags fmtnumeric; ';
269
318
  put ' run; ';
270
- put ' proc sql;drop view &tempds; ';
271
319
  put ' %end; ';
272
320
  put ' %else %if &engine=DATASTEP %then %do; ';
273
321
  put ' %datastep: ';
274
- put ' %local cols i tempds; ';
275
- put ' %let cols=0; ';
276
- put ' %if %sysfunc(exist(&ds)) ne 1 & %sysfunc(exist(&ds,VIEW)) ne 1 %then %do; ';
322
+ put ' %if %sysfunc(exist(&ds)) ne 1 & %sysfunc(exist(&ds,VIEW)) ne 1 ';
323
+ put ' %then %do; ';
277
324
  put ' %put &sysmacroname: &ds NOT FOUND!!!; ';
278
325
  put ' %return; ';
279
326
  put ' %end; ';
280
- put ' %if &fmt=Y %then %do; ';
281
- put ' %put converting every variable to a formatted variable; ';
282
- put ' /* see mp_ds2fmtds.sas for source */ ';
283
- put ' proc contents noprint data=&ds ';
284
- put ' out=_data_(keep=name type length format formatl formatd varnum); ';
285
- put ' run; ';
286
- put ' proc sort; ';
287
- put ' by varnum; ';
288
- put ' run; ';
289
- put ' %local fmtds; ';
290
- put ' %let fmtds=%scan(&syslast,2,.); ';
291
- put ' /* prepare formats and varnames */ ';
292
- put ' data _null_; ';
293
- put ' if _n_=1 then call symputx(''nobs'',nobs,''l''); ';
294
- put ' set &fmtds end=last nobs=nobs; ';
295
- put ' name=upcase(name); ';
296
- put ' /* fix formats */ ';
297
- put ' if type=2 or type=6 then do; ';
298
- put ' length fmt $49.; ';
299
- put ' if format='''' then fmt=cats(''$'',length,''.''); ';
300
- put ' else if formatl=0 then fmt=cats(format,''.''); ';
301
- put ' else fmt=cats(format,formatl,''.''); ';
302
- put ' newlen=max(formatl,length); ';
303
- put ' end; ';
304
- put ' else do; ';
305
- put ' if format='''' then fmt=''best.''; ';
306
- put ' else if formatl=0 then fmt=cats(format,''.''); ';
307
- put ' else if formatd=0 then fmt=cats(format,formatl,''.''); ';
308
- put ' else fmt=cats(format,formatl,''.'',formatd); ';
309
- put ' /* needs to be wide, for datetimes etc */ ';
310
- put ' newlen=max(length,formatl,24); ';
311
- put ' end; ';
312
- put ' /* 32 char unique name */ ';
313
- put ' newname=''sasjs''!!substr(cats(put(md5(name),$hex32.)),1,27); ';
314
327
  put ' ';
315
- put ' call symputx(cats(''name'',_n_),name,''l''); ';
316
- put ' call symputx(cats(''newname'',_n_),newname,''l''); ';
317
- put ' call symputx(cats(''len'',_n_),newlen,''l''); ';
318
- put ' call symputx(cats(''fmt'',_n_),fmt,''l''); ';
319
- put ' call symputx(cats(''type'',_n_),type,''l''); ';
320
- put ' run; ';
321
- put ' data &fmtds; ';
328
+ put ' %if &fmt=Y %then %do; ';
329
+ put ' data _data_; ';
322
330
  put ' /* rename on entry */ ';
323
331
  put ' set &ds(rename=( ';
324
- put ' %local i; ';
325
- put ' %do i=1 %to &nobs; ';
332
+ put ' %do i=1 %to &numcols; ';
326
333
  put ' &&name&i=&&newname&i ';
327
334
  put ' %end; ';
328
335
  put ' )); ';
329
- put ' %do i=1 %to &nobs; ';
336
+ put ' %do i=1 %to &numcols; ';
330
337
  put ' length &&name&i $&&len&i; ';
331
338
  put ' &&name&i=left(put(&&newname&i,&&fmt&i)); ';
332
339
  put ' drop &&newname&i; ';
333
340
  put ' %end; ';
334
341
  put ' if _error_ then call symputx(''syscc'',1012); ';
335
342
  put ' run; ';
336
- put ' %let ds=&fmtds; ';
337
- put ' %end; /* &fmt=Y */ ';
338
- put ' data _null_;file &jref mod encoding=''utf-8'' ; ';
339
- put ' put "["; call symputx(''cols'',0,''l''); ';
340
- put ' proc sort ';
341
- put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
342
- put ' out=_data_; ';
343
- put ' by varnum; ';
344
- put ' ';
345
- put ' data _null_; ';
346
- put ' set _last_ end=last; ';
347
- put ' call symputx(cats(''name'',_n_),name,''l''); ';
348
- put ' call symputx(cats(''type'',_n_),type,''l''); ';
349
- put ' call symputx(cats(''len'',_n_),length,''l''); ';
350
- put ' if last then call symputx(''cols'',_n_,''l''); ';
351
- put ' run; ';
343
+ put ' %let fmtds=&syslast; ';
344
+ put ' %end; ';
352
345
  put ' ';
353
346
  put ' proc format; /* credit yabwon for special null removal */ ';
354
- put ' value bart ';
347
+ put ' value bart (default=40) ';
355
348
  put ' %if &missing=NULL %then %do; ';
356
349
  put ' ._ - .z = null ';
357
350
  put ' %end; ';
@@ -362,20 +355,23 @@ data _null_;
362
355
  put ' %end; ';
363
356
  put ' other = [best.]; ';
364
357
  put ' ';
365
- put ' data;run; %let tempds=&syslast; /* temp table for spesh char management */ ';
366
- put ' proc sql; drop table &tempds; ';
367
358
  put ' data &tempds/view=&tempds; ';
368
359
  put ' attrib _all_ label=''''; ';
369
- put ' %do i=1 %to &cols; ';
370
- put ' %if &&type&i=char %then %do; ';
360
+ put ' %do i=1 %to &numcols; ';
361
+ put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
371
362
  put ' length &&name&i $32767; ';
372
363
  put ' format &&name&i $32767.; ';
373
364
  put ' %end; ';
374
365
  put ' %end; ';
375
- put ' set &ds; ';
366
+ put ' %if &fmt=Y %then %do; ';
367
+ put ' set &fmtds; ';
368
+ put ' %end; ';
369
+ put ' %else %do; ';
370
+ put ' set &ds; ';
371
+ put ' %end; ';
376
372
  put ' format _numeric_ bart.; ';
377
- put ' %do i=1 %to &cols; ';
378
- put ' %if &&type&i=char %then %do; ';
373
+ put ' %do i=1 %to &numcols; ';
374
+ put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
379
375
  put ' &&name&i=''"''!!trim(prxchange(''s/"/\"/'',-1, ';
380
376
  put ' prxchange(''s/''!!''0A''x!!''/\n/'',-1, ';
381
377
  put ' prxchange(''s/''!!''0D''x!!''/\r/'',-1, ';
@@ -385,49 +381,72 @@ data _null_;
385
381
  put ' %end; ';
386
382
  put ' %end; ';
387
383
  put ' run; ';
384
+ put ' ';
388
385
  put ' /* write to temp loc to avoid _webout truncation ';
389
386
  put ' - https://support.sas.com/kb/49/325.html */ ';
390
387
  put ' filename _sjs temp lrecl=131068 encoding=''utf-8''; ';
391
388
  put ' data _null_; file _sjs lrecl=131068 encoding=''utf-8'' mod ; ';
389
+ put ' if _n_=1 then put "["; ';
392
390
  put ' set &tempds; ';
393
391
  put ' if _n_>1 then put "," @; put ';
394
392
  put ' %if &action=ARR %then "[" ; %else "{" ; ';
395
- put ' %do i=1 %to &cols; ';
393
+ put ' %do i=1 %to &numcols; ';
396
394
  put ' %if &i>1 %then "," ; ';
397
395
  put ' %if &action=OBJ %then """&&name&i"":" ; ';
398
396
  put ' &&name&i ';
399
397
  put ' %end; ';
400
398
  put ' %if &action=ARR %then "]" ; %else "}" ; ; ';
401
- put ' proc sql; ';
402
- put ' drop view &tempds; ';
403
399
  put ' /* now write the long strings to _webout 1 byte at a time */ ';
404
400
  put ' data _null_; ';
405
401
  put ' length filein 8 fileid 8; ';
406
- put ' filein = fopen("_sjs",''I'',1,''B''); ';
407
- put ' fileid = fopen("&jref",''A'',1,''B''); ';
408
- put ' rec = ''20''x; ';
402
+ put ' filein=fopen("_sjs",''I'',1,''B''); ';
403
+ put ' fileid=fopen("&jref",''A'',1,''B''); ';
404
+ put ' rec=''20''x; ';
409
405
  put ' do while(fread(filein)=0); ';
410
- put ' rc = fget(filein,rec,1); ';
411
- put ' rc = fput(fileid, rec); ';
412
- put ' rc =fwrite(fileid); ';
406
+ put ' rc=fget(filein,rec,1); ';
407
+ put ' rc=fput(fileid, rec); ';
408
+ put ' rc=fwrite(fileid); ';
413
409
  put ' end; ';
414
- put ' rc = fclose(filein); ';
415
- put ' rc = fclose(fileid); ';
410
+ put ' /* close out the table */ ';
411
+ put ' rc=fput(fileid, "]"); ';
412
+ put ' rc=fwrite(fileid); ';
413
+ put ' rc=fclose(filein); ';
414
+ put ' rc=fclose(fileid); ';
416
415
  put ' run; ';
417
416
  put ' filename _sjs clear; ';
418
- put ' data _null_; file &jref mod encoding=''utf-8'' ; ';
419
- put ' put "]"; ';
417
+ put ' %end; ';
418
+ put ' ';
419
+ put ' proc sql; ';
420
+ put ' drop view &tempds; ';
421
+ put ' drop table &colinfo; ';
422
+ put ' ';
423
+ put ' %if &showmeta=YES %then %do; ';
424
+ put ' data _null_; file &jref encoding=''utf-8'' mod; ';
425
+ put ' put ", ""$%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":{""vars"":{"; ';
426
+ put ' do i=1 to &numcols; ';
427
+ put ' name=quote(trim(symget(cats(''name'',i)))); ';
428
+ put ' format=quote(trim(symget(cats(''fmt'',i)))); ';
429
+ put ' label=quote(trim(symget(cats(''label'',i)))); ';
430
+ put ' length=quote(trim(symget(cats(''length'',i)))); ';
431
+ put ' type=quote(trim(symget(cats(''typelong'',i)))); ';
432
+ put ' if i>1 then put "," @@; ';
433
+ put ' put name '':{"format":'' format '',"label":'' label ';
434
+ put ' '',"length":'' length '',"type":'' type ''}''; ';
435
+ put ' end; ';
436
+ put ' put ''}}''; ';
420
437
  put ' run; ';
421
438
  put ' %end; ';
422
439
  put '%end; ';
423
440
  put ' ';
424
441
  put '%else %if &action=CLOSE %then %do; ';
425
- put ' data _null_;file &jref encoding=''utf-8'' mod ; ';
442
+ put ' data _null_; file &jref encoding=''utf-8'' mod ; ';
426
443
  put ' put "}"; ';
427
444
  put ' run; ';
428
445
  put '%end; ';
429
446
  put '%mend mp_jsonout; ';
430
- put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y,missing=NULL); ';
447
+ put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y,missing=NULL ';
448
+ put ' ,showmeta=NO ';
449
+ put '); ';
431
450
  put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
432
451
  put ' sasjs_tables SYS_JES_JOB_URI; ';
433
452
  put '%if %index("&_debug",log) %then %let _debug=131; ';
@@ -549,12 +568,13 @@ data _null_;
549
568
  put ' ';
550
569
  put ' /* setup json */ ';
551
570
  put ' data _null_;file &fref; ';
552
- put ' put ''{"START_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''"''; ';
571
+ put ' put ''{"SYSDATE" : "'' "&SYSDATE" ''"''; ';
572
+ put ' put '',"SYSTIME" : "'' "&SYSTIME" ''"''; ';
553
573
  put ' run; ';
554
574
  put '%end; ';
555
575
  put '%else %if &action=ARR or &action=OBJ %then %do; ';
556
576
  put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
557
- put ' ,jref=&fref,engine=DATASTEP,missing=&missing ';
577
+ put ' ,jref=&fref,engine=DATASTEP,missing=&missing,showmeta=&showmeta ';
558
578
  put ' ) ';
559
579
  put '%end; ';
560
580
  put '%else %if &action=CLOSE %then %do; ';
@@ -574,9 +594,6 @@ data _null_;
574
594
  put ' data _null_; file &fref mod; put ",""WORK"":{"; ';
575
595
  put ' %do i=1 %to &wtcnt; ';
576
596
  put ' %let wt=&&wt&i; ';
577
- put ' proc contents noprint data=&wt ';
578
- put ' out=_data_ (keep=name type length format:); ';
579
- put ' run;%let tempds=%scan(&syslast,2,.); ';
580
597
  put ' data _null_; file &fref mod; ';
581
598
  put ' dsid=open("WORK.&wt",''is''); ';
582
599
  put ' nlobs=attrn(dsid,''NLOBS''); ';
@@ -586,8 +603,7 @@ data _null_;
586
603
  put ' put " ""&wt"" : {"; ';
587
604
  put ' put ''"nlobs":'' nlobs; ';
588
605
  put ' put '',"nvars":'' nvars; ';
589
- put ' %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP) ';
590
- put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP) ';
606
+ put ' %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,showmeta=YES) ';
591
607
  put ' data _null_; file &fref mod;put "}"; ';
592
608
  put ' %end; ';
593
609
  put ' data _null_; file &fref mod;put "}";run; ';
@@ -612,6 +628,9 @@ data _null_;
612
628
  put ' put '',"SYSVLONG" : '' sysvlong; ';
613
629
  put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
614
630
  put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
631
+ put ' memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)"; ';
632
+ put ' memsize=quote(cats(memsize)); ';
633
+ put ' put '',"MEMSIZE" : '' memsize; ';
615
634
  put ' put "}"; ';
616
635
  put ' ';
617
636
  put ' %if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do; ';
@@ -645,8 +664,10 @@ data _null_;
645
664
  put '%global __program _program;';
646
665
  put '%let _program=%sysfunc(coalescec(&__program,&_program));';
647
666
  put ' ';
648
- put '%macro webout(action,ds,dslabel=,fmt=);';
649
- put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)';
667
+ put '%macro webout(action,ds,dslabel=,fmt=,missing=NULL,showmeta=NO);';
668
+ put ' %mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing';
669
+ put ' ,showmeta=&showmeta';
670
+ put ' )';
650
671
  put '%mend;';
651
672
  run;
652
673
 
@@ -29,6 +29,10 @@
29
29
  @param [in] stream=(Y) Change to N if not streaming to _webout
30
30
  @param [in] missing= (NULL) Special numeric missing values can be sent as NULL
31
31
  (eg `null`) or as STRING values (eg `".a"` or `".b"`)
32
+ @param [in] showmeta= (NO) Set to YES to output metadata alongside each table,
33
+ such as the column formats and types. The metadata is contained inside an
34
+ object with the same name as the table but prefixed with a dollar sign - ie,
35
+ `,"$tablename":{"formats":{"col1":"$CHAR1"},"types":{"COL1":"C"}}`
32
36
 
33
37
  <h4> SAS Macros </h4>
34
38
  @li mp_jsonout.sas
@@ -38,7 +42,9 @@
38
42
  @author Allan Bowe, source: https://github.com/sasjs/core
39
43
 
40
44
  **/
41
- %macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y,missing=NULL);
45
+ %macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y,missing=NULL
46
+ ,showmeta=NO
47
+ );
42
48
  %global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
43
49
  sasjs_tables SYS_JES_JOB_URI;
44
50
  %if %index("&_debug",log) %then %let _debug=131;
@@ -160,12 +166,13 @@
160
166
 
161
167
  /* setup json */
162
168
  data _null_;file &fref;
163
- put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
169
+ put '{"SYSDATE" : "' "&SYSDATE" '"';
170
+ put ',"SYSTIME" : "' "&SYSTIME" '"';
164
171
  run;
165
172
  %end;
166
173
  %else %if &action=ARR or &action=OBJ %then %do;
167
174
  %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
168
- ,jref=&fref,engine=DATASTEP,missing=&missing
175
+ ,jref=&fref,engine=DATASTEP,missing=&missing,showmeta=&showmeta
169
176
  )
170
177
  %end;
171
178
  %else %if &action=CLOSE %then %do;
@@ -185,9 +192,6 @@
185
192
  data _null_; file &fref mod; put ",""WORK"":{";
186
193
  %do i=1 %to &wtcnt;
187
194
  %let wt=&&wt&i;
188
- proc contents noprint data=&wt
189
- out=_data_ (keep=name type length format:);
190
- run;%let tempds=%scan(&syslast,2,.);
191
195
  data _null_; file &fref mod;
192
196
  dsid=open("WORK.&wt",'is');
193
197
  nlobs=attrn(dsid,'NLOBS');
@@ -197,8 +201,7 @@
197
201
  put " ""&wt"" : {";
198
202
  put '"nlobs":' nlobs;
199
203
  put ',"nvars":' nvars;
200
- %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
201
- %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
204
+ %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,showmeta=YES)
202
205
  data _null_; file &fref mod;put "}";
203
206
  %end;
204
207
  data _null_; file &fref mod;put "}";run;
@@ -223,6 +226,9 @@
223
226
  put ',"SYSVLONG" : ' sysvlong;
224
227
  put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
225
228
  put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
229
+ memsize="%sysfunc(INPUTN(%sysfunc(getoption(memsize)), best.),sizekmg.)";
230
+ memsize=quote(cats(memsize));
231
+ put ',"MEMSIZE" : ' memsize;
226
232
  put "}";
227
233
 
228
234
  %if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do;