BookmarkSubscribeRSS Feed
cvelazquez
Calcite | Level 5

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.

csv file.PNG

1 REPLY 1
ChrisHemedinger
Community Manager

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;
Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 605 views
  • 0 likes
  • 2 in conversation