How to get a download button in the report output in SAS 9.3

Reply
New Contributor
Posts: 3

How to get a download button in the report output in SAS 9.3

Hi All,

Can you please help me in sharing the code to get a download button after generating the ods output of a SAS report (format in Excel) in SAS 9.3.

Rather than viewing the file you will also get a download option to download the output file in SAS 9.3.

Kindly find the attached image where i am getting a download button and after clicking the hyperlink,i get the option to save the output file in Excel in my local computer.

I have written the code in SAS 9.1 but the same code is not working in SAS 9.3.So please guide me how to update the same in SAS 9.3.

Please let me know if you required any further details form me.

Thanks.

dwnloadbutton.bmp

Super User
Posts: 7,762

Re: How to get a download button in the report output in SAS 9.3

Would you kindly provide the code?

I don't really find where your problem is.

- Does the code that worked in 9.1 crash in 9.3?

- do you get the button in 9.1 but not in 9.3?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: How to get a download button in the report output in SAS 9.3

Posted in reply to KurtBremser

Hi Dear,

I could able to use the code in 9.3 to get the download button,but the issue is I couldn't able to download the file in excel format,By default its in csv format.

Kindly find the below code for your reference and help me in changing the default format as Excel.

%let csv=%qsubstr(&_replay,2,%length(&_replay)-3).document.csv;

ods html style =mystyle;

data _NULL_;

file _webout;

put '<table border="1" width="100" bordercolorlight=#BBBBBB cellspacing="0" cellpadding="0">';

put "<head>";

put '  <tr>';

put '    <td width="100%" bgcolor="#CCFFFF" align="center">';

put "       <a href='&CSV' target='_blank'><font size='2' color='black'>Download</font></a><br>";

put '  </tr>';

put '</table>';

put '<!--END OF EDIT-->';

run;


filename csvout catalog "&_tmpcat..document.csv";



Super User
Posts: 7,762

Re: How to get a download button in the report output in SAS 9.3

So it seems the file is created as .csv in another part of the program, you need to look there.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Trusted Advisor
Posts: 3,212

Re: How to get a download button in the report output in SAS 9.3

Why not save the table as excel table using the webpage data.
Instruct your user to move the mouse to the table at the webpage and other mouse button and "export to excel" For small tables very workable.

Downloading a file is possible when:

1/ you have stored that in a dataset accessible by a webserver so you can make a hyperlink (http://... / to that
2/ using the WebDAV protocol that can access the data.
You have stored you csv in a SAS catalog. Yes that is possible like also sas-sources log list and much more. It is easy to offer it cross-platform with RLS.
The issue is a SAS catalog is only readable with SAS tooling.

Uploading files is documented at: SAS(R) 9.3 Stored Processes: Developer's Guide . you can upload to catalogs.

The other way around I have not found/seen, but remember this thread https://communities.sas.com/message/203921

Nikola Markovic did a nice approach. I think you need some adjustments but the idea is good.

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 4 replies
  • 346 views
  • 0 likes
  • 3 in conversation