Hello..
I am trying to create a stored process, in which i have to just grab already created excel report from the server and produce the same (without any changes) as an output of the stored process execution. i am trying to do this using stpsrv_header but its not working.
data _null_;
rc= stpsrv_header('Content-type', 'application/vnd.ms-excel');
rc= stpsrv_header('Content-disposition', 'attachment;
filename=outtest.xls');
run;
Did anyone tried this before? Please let me know.
Thanks,
Mike
Michael,
This should work. Have a look at the second half of this post that I wrote ages ago.
You need to use the STP webapp, you need to have Streaming output enabled. Here's the code from the other post.
filename myFileInput="/myTempFileLocation/&filenameParameter..xml";
%let RV=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel));
%let RV=%sysfunc(stpsrv_header(Content-disposition,attachment; filename= Histostaffperformance.xml));
data outmenow;
length data $1;
infile myFileInput recfm=n;
file _webout recfm=n mod;
input data $char1. @@;
put data $char1. @@;
run;
Good luck.
Nik
Have you tried my suggestion I gave you in the other thread about the same issue?
Yes Kurt, I tried it.
rc = stpsrv_header('Content-disposition','attachment; filename="test.xls"');
Its not giving me any error message but not doing what i intended for. Its just getting executed successfully and no result is coming out.
Michael,
This should work. Have a look at the second half of this post that I wrote ages ago.
You need to use the STP webapp, you need to have Streaming output enabled. Here's the code from the other post.
filename myFileInput="/myTempFileLocation/&filenameParameter..xml";
%let RV=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel));
%let RV=%sysfunc(stpsrv_header(Content-disposition,attachment; filename= Histostaffperformance.xml));
data outmenow;
length data $1;
infile myFileInput recfm=n;
file _webout recfm=n mod;
input data $char1. @@;
put data $char1. @@;
run;
Good luck.
Nik
Hi Boemskats,
Thank you,
Greatly appreciate it.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.