BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cneed
Obsidian | Level 7

How can I export a sas table to an excel spreadsheet?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
sustagens
Pyrite | Level 9
proc export data = sashelp.baseball (where=(Team="Atlanta")) 
outfile = "G:\SAS Downloads\Baseball_Teams.xls" 
dbms = xls replace;
sheet = "Atlanta";
run;

View solution in original post

4 REPLIES 4
sustagens
Pyrite | Level 9
proc export data = sashelp.baseball (where=(Team="Atlanta")) 
outfile = "G:\SAS Downloads\Baseball_Teams.xls" 
dbms = xls replace;
sheet = "Atlanta";
run;
cneed
Obsidian | Level 7

@sustagens  Is it possible to just select certain columns of the dataset to export? This is the code I have tried and it is giving me an "invalid option name SELECT" error.

 

proc export data = Data.master_After2001WithGPA (select=(studentID, Gender, GPA))
dbms = xls
outfile = "/folders/myfolders/Question6_Output.xls"
replace;

run;

unison
Lapis Lazuli | Level 10

the correct syntax is keep= as opposed to select=. Also remove the commas in the field list

-unison
unison
Lapis Lazuli | Level 10

If you can utilize the xlsx engine, I think this is the cleanest way to do it:

libname xlout xlsx '/folders/myfolders/SASHelp.xlsx';
proc datasets nolist;
 copy in=sashelp out=xlout;
 select shoes class retail / memtype=data;
run; quit;
libname xlout clear;
-unison

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 815 views
  • 1 like
  • 3 in conversation