Thursday, June 9, 2011

A SAS Stored Process Web Application that exports a Dataset to an Excel sheet

While creating Drill down reports, you might need to provide the users with the option of downloading the entire data to an excel sheet. For this you may need to create an interface(Code) where the Export button is displayed and a stored process that converts the Dataset to the excel sheet.



/******Code for Converting the data to excel ******/

data _null_;
rc=stpsrv_header('Content-type','application/vnd.ms-excel');
rc=stpsrv_header('Content-disposition','attachment; filename=temp.xls');
run;
ods tagsets.excelxp file=_webout style=sasweb options(embedded_titles="yes"
embedded_footers="yes"
print_header='&B&CThis is a test'
print_footer='&B&CThis is a footer printed on &D');
title "Export To Excel";
proc print data=&DSN ;
run;
ods tagsets.excelxp close;

7 comments:

  1. HI

    I am using SAS EG 5.1 and creating a stored process to output a report to excel..I followed the same steps and but I get only a blank page. I am not sure what am I missing. Can you help me please. sas.bhuvana@gmail.com

    ReplyDelete
  2. Hello Bhuvana,
    I have created a stored process for conversion of data to an excel sheet,but it works,no issues with. SAS Enterprise miner

    ReplyDelete
  3. Thanks a lot.This was very helpful.

    ReplyDelete
  4. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.sas training in Chennai

    ReplyDelete
  5. very good blog, for more information of SAS BI tutorials Check this site Mindmajix for indepth SAS BI Tutorials

    Go here if you’re looking for information on SAS BI Blogs

    ReplyDelete



  6. The structs is a complex data type declaration used in the C programming language that helps you to define a physically grouped list of variables to be placed under one name in a block of memory.
    struts training in chennai | struts training | struts training center in chennai

    ReplyDelete
  7. I agree with your post. Android software development kit makes the application development process lot simpler and effective. You can create best performing android application with ease. Android Training Institutes in Chennai | Android Training in Chennai

    ReplyDelete