« Software for Printing Directory Contents | Main | Connecting to Microsoft SQL Server from SAS with OleDB »

Proc DBLOAD - Send SAS Data to Excel

I came across this sample on the SAS Support website.

I constantly get people in my organization who require data. Usually it’s a simple table with a few columns. Since the Microsoft Office Suite is installed on our computers and is supported software, I opt for giving them Excel spreadsheets. That way they can play with the data themselves. Here is a nice chunk of code to send your SAS Data to an Excel file:

/* This program writes a SAS Data Set to EXCEL using DBLOAD */

proc dbload dbms=xls data=sasuser.houses;
path=’c:\path\to\my\folder\filename.xls’;
putnames=yes;
label;
reset all;
limit=0;
load;
run;

Using my my test dataset, Class, we can see the code works quite nicely.

%let filename = ‘c:\class.xls’;

proc dbload dbms=xls data=class;
path=&filename;
putnames=yes;
label;
reset all;
limit=0;
load;
run;

/*open the excel file*/
options nowait;
X &filename;
*systask command “&filename”;/*try this if the X command doesn’t work*/

Keep your computer clean - don’t forget to delete c:\class.xls afterwards.

 

Posted on Monday, March 31, 2008 by Registered CommenterJared in | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>