How can I export a sas table to an excel spreadsheet?
Thanks!
proc export data = sashelp.baseball (where=(Team="Atlanta"))
outfile = "G:\SAS Downloads\Baseball_Teams.xls"
dbms = xls replace;
sheet = "Atlanta";
run;
proc export data = sashelp.baseball (where=(Team="Atlanta"))
outfile = "G:\SAS Downloads\Baseball_Teams.xls"
dbms = xls replace;
sheet = "Atlanta";
run;
@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;
the correct syntax is keep= as opposed to select=. Also remove the commas in the field list
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.