Your SAS programs, embedded in web apps and elsewhere

Add a download link

Reply
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:
http://finance.yahoo.com/q/hp?s=^GSPC

Any hints are appreciated!
SAS Super FREQ
Posts: 304

Re: Add a download link

You will find many good references if you go to http://support.sas.com 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:

[pre]
%let RV=%sysfunc(appsrv_header(Content-type, application/vnd.ms-excel));
%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;
[/pre]

Vince DelGobbo
SAS R&D
Ask a Question
Discussion stats
  • 1 reply
  • 266 views
  • 0 likes
  • 2 in conversation