35 %macro mm_webout(action,ds,dslabel=,fref=_webout,fmt=Y);
36 %global _webin_file_count _webin_fileref1 _webin_name1 _program _debug
40 %
if &action=FETCH %then %
do;
41 %
if %str(&_debug) ge 131 %then %
do;
42 options mprint notes mprintnest;
44 %let _webin_file_count=%eval(&_webin_file_count+0);
46 %
do i=1 %to &_webin_file_count;
47 %
if &_webin_file_count=1 %then %
do;
48 %let _webin_fileref1=&_webin_fileref;
49 %let _webin_name1=&_webin_name;
52 infile &&_webin_fileref&i termstr=crlf;
54 call symputx(
'input_statement',_infile_);
55 putlog
"&&_webin_name&i input statement: " _infile_;
58 infile &&_webin_fileref&i firstobs=2 dsd termstr=crlf encoding=
'utf-8';
59 input &input_statement;
60 %
if %str(&_debug) ge 131 %then %
do;
61 if _n_<20 then putlog _infile_;
64 %let sasjs_tables=&sasjs_tables &&_webin_name&i;
68 %
else %
if &action=OPEN %then %
do;
72 rc = stpsrv_header(
'Content-type',
"text/html; encoding=utf-8");
76 data _null_;file &fref encoding=
'utf-8';
77 %
if %str(&_debug) ge 131 %then %
do;
78 put
'>>weboutBEGIN<<';
80 put
'{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"';
85 %
else %
if &action=ARR or &action=OBJ %then %
do;
86 %
if &sysver=9.4 %then %
do;
87 %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
88 ,engine=PROCJSON,dbg=%str(&_debug)
92 %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
93 ,engine=DATASTEP,dbg=%str(&_debug)
97 %
else %
if &action=CLOSE %then %
do;
98 %
if %str(&_debug) ge 131 %then %
do;
101 data;run;%let tempds=%scan(&syslast,2,.);
102 ods output Members=&tempds;
103 proc datasets library=WORK memtype=data;
104 %local wtcnt;%let wtcnt=0;
107 if not (name =:
"DATA");
109 call symputx(
'wt'!!left(i),name,
'l');
110 call symputx(
'wtcnt',i,
'l');
111 data _null_; file &fref encoding=
'utf-8';
115 proc contents noprint data=&wt
116 out=_data_ (keep=name type length format:);
117 run;%let tempds=%scan(&syslast,2,.);
118 data _null_; file &fref encoding=
'utf-8';
119 dsid=open(
"WORK.&wt",
'is');
120 nlobs=attrn(dsid,
'NLOBS');
121 nvars=attrn(dsid,
'NVARS');
123 if &i>1 then put
','@;
125 put
'"nlobs":' nlobs;
126 put
',"nvars":' nvars;
127 %mp_jsonout(OBJ,&tempds,jref=&fref,dslabel=colattrs,engine=DATASTEP)
128 %mp_jsonout(OBJ,&wt,jref=&fref,dslabel=first10rows,engine=DATASTEP)
129 data _null_; file &fref encoding=
'utf-8';
132 data _null_; file &fref encoding=
'utf-8';
137 data _null_;file &fref mod encoding=
'utf-8';
138 _PROGRAM=quote(trim(resolve(symget(
'_PROGRAM'))));
139 put
",""SYSUSERID"" : ""&sysuserid"" ";
140 put
",""MF_GETUSER"" : ""%mf_getuser()"" ";
141 put
",""_DEBUG"" : ""&_debug"" ";
142 _METAUSER=quote(trim(symget(
'_METAUSER')));
143 put
",""_METAUSER"": " _METAUSER;
144 _METAPERSON=quote(trim(symget(
'_METAPERSON')));
145 put
',"_METAPERSON": ' _METAPERSON;
146 put
',"_PROGRAM" : ' _PROGRAM ;
147 put
",""SYSCC"" : ""&syscc"" ";
148 put
",""SYSERRORTEXT"" : ""&syserrortext"" ";
149 put
",""SYSHOSTNAME"" : ""&syshostname"" ";
150 put
",""SYSJOBID"" : ""&sysjobid"" ";
151 put
",""SYSSITE"" : ""&syssite"" ";
152 put
",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
153 put
',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
155 %
if %str(&_debug) ge 131 %then %
do;