BookmarkSubscribeRSS Feed
Somu
Calcite | Level 5

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

4 REPLIES 4
Kurt_Bremser
Super User

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?

Somu
Calcite | Level 5

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";



jakarman
Barite | Level 11

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 --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1435 views
  • 0 likes
  • 3 in conversation