Your SAS programs, embedded in web apps and elsewhere

Add a download link

Frequent Contributor
Posts: 77

Add a download link

I am building a SPWA based web application. I want to add a download link to the web page for users to download the data to an Excel spreadsheet like "Donwload to Spreadsheet" link shown in the following Yahoo Historical Stock Price page:^GSPC

Any hints are appreciated!
SAS Employee
Posts: 284

Re: Add a download link

You will find many good references if you go to and then search for:

download csv

The key is to create to a streaming stored process that sets the appropriate MIME headers. Give this (untested) code a try:

%let RV=%sysfunc(appsrv_header(Content-type, application/;
%let RV=%sysfunc(appsrv_header(Content-disposition, %str(attachment; filename=temp.csv)));

ods listing close;
ods csv file=_webout;
proc print data=sashelp.class; run; quit;
ods csv close;

Vince DelGobbo
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation