50%
if not(%eval(%unquote(&iftrue))) %then %
return;
52%let contentype=%upcase(&contenttype);
53%let outref=%upcase(&outref);
54%local platform; %let platform=%mf_getplatform();
63 set sashelp.vextfl(where=(upcase(fileref)=
"&outref"));
64 if xengine=
'STREAM' then call symputx(
'streamweb',1,
'l');
67%
if &contentype=CSV %then %
do;
68 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
70 rc=stpsrv_header(
'Content-Type',
'application/csv');
71 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
74 %
else %
if &platform=SASVIYA %then %
do;
75 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.txt'
76 contenttype=
'application/csv'
77 contentdisp=
"attachment; filename=&outname";
79 %
else %
if &platform=SASJS %then %
do;
80 %mfs_httpheader(Content-Type,application/csv)
81 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
84%
else %
if &contentype=EXCEL %then %
do;
86 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
88 rc=stpsrv_header(
'Content-Type',
'application/vnd.ms-excel');
89 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
92 %
else %
if &platform=SASVIYA %then %
do;
93 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.xls'
94 contenttype=
'application/vnd.ms-excel'
95 contentdisp=
"attachment; filename=&outname";
97 %
else %
if &platform=SASJS %then %
do;
98 %mfs_httpheader(Content-Type,application/vnd.ms-excel)
99 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
102%
else %
if &contentype=GIF or &contentype=JPEG or &contentype=PNG %then %
do;
103 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
105 rc=stpsrv_header(
'Content-Type',
"image/%lowcase(&contenttype)");
108 %
else %
if &platform=SASVIYA %then %
do;
109 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI"
110 contenttype=
"image/%lowcase(&contenttype)";
112 %
else %
if &platform=SASJS %then %
do;
113 %mfs_httpheader(Content-Type,image/%lowcase(&contenttype))
116%
else %
if &contentype=HTML or &contenttype=MARKDOWN %then %
do;
117 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
119 rc=stpsrv_header(
'Content-Type',
"text/%lowcase(&contenttype)");
120 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
123 %
else %
if &platform=SASVIYA %then %
do;
124 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
"_webout.json"
125 contenttype=
"text/%lowcase(&contenttype)"
126 contentdisp=
"attachment; filename=&outname";
128 %
else %
if &platform=SASJS %then %
do;
129 %mfs_httpheader(Content-Type,text/%lowcase(&contenttype))
130 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
133%
else %
if &contentype=TEXT %then %
do;
134 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
136 rc=stpsrv_header(
'Content-Type',
'application/text');
137 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
140 %
else %
if &platform=SASVIYA %then %
do;
141 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.txt'
142 contenttype=
'application/text'
143 contentdisp=
"attachment; filename=&outname";
145 %
else %
if &platform=SASJS %then %
do;
146 %mfs_httpheader(Content-Type,application/text)
147 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
150%
else %
if &contentype=WOFF or &contentype=WOFF2 or &contentype=TTF %then %
do;
151 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
153 rc=stpsrv_header(
'Content-Type',
"font/%lowcase(&contenttype)");
156 %
else %
if &platform=SASVIYA %then %
do;
157 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI"
158 contenttype=
"font/%lowcase(&contenttype)";
160 %
else %
if &platform=SASJS %then %
do;
161 %mfs_httpheader(Content-Type,font/%lowcase(&contenttype))
164%
else %
if &contentype=XLSX %then %
do;
165 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
167 rc=stpsrv_header(
'Content-Type',
168 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
169 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
172 %
else %
if &platform=SASVIYA %then %
do;
173 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.xls'
175 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
176 contentdisp=
"attachment; filename=&outname";
178 %
else %
if &platform=SASJS %then %
do;
179 %mfs_httpheader(Content-Type
180 ,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
182 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
185%
else %
if &contentype=PDF %then %
do;
186 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
188 rc=stpsrv_header(
'Content-Type',
'application/pdf');
189 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
192 %
else %
if &platform=SASVIYA %then %
do;
193 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.pdf'
194 contenttype=
'application/pdf'
195 contentdisp=
"attachment; filename=&outname";
197 %
else %
if &platform=SASJS %then %
do;
198 %mfs_httpheader(Content-Type,application/pdf)
199 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
202%
else %
if &contentype=ZIP %then %
do;
203 %
if (&platform=SASMETA and &streamweb=1) %then %
do;
205 rc=stpsrv_header(
'Content-Type',
'application/zip');
206 rc=stpsrv_header(
'Content-disposition',
"attachment; filename=&outname");
209 %
else %
if &platform=SASVIYA %then %
do;
210 filename &outref filesrvc parenturi=
"&SYS_JES_JOB_URI" name=
'_webout.zip'
211 contenttype=
'application/zip'
212 contentdisp=
"attachment; filename=&outname";
214 %
else %
if &platform=SASJS %then %
do;
215 %mfs_httpheader(Content-Type,application/zip)
216 %mfs_httpheader(Content-disposition,%str(attachment; filename=&outname))
220 %put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
223%
if &inref ne 0 %then %
do;
224 %mp_binarycopy(inref=&inref,outref=&outref)
227 %mp_binarycopy(inloc=
"&inloc",outref=&outref)