I have a stored process that produces a table report. When the report is run by the user, I want it to prompt the user to download a csv file. I'm able to get that far with the following code:
data _null_;
if upcase("&outtype") = "CSV" then do;
rc = stpsrv_header('Content-type','application/vnd.ms-excel;');
rc = stpsrv_header('Content-disposition','attachment; filename=temp.csv');
end;
run;
But the csv file contains all the HTML code (see picture). I need the code to download the file with only the output table and not the HTML code.
I assume you have ODS HTML in the code somewhere. If you want the output to be CSV instead, try the CSV destination instead of the HTML destination:
ods csv (id=file) file=_webout;
/* report code */
ods csv (id=file) close;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.