I have the following results from proc freq tables statement. I will give just a couple lines like:
Age Grouping
County 0-9 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80 and Above Total
Baker 31 14 25 23 12 16 22 13 0 156
Benton 49 141 250 74 46 47 33 7 9 656
. . . . .
My question is what is the easiest way I can export the table from the Results Viewer into Excel.
Thank you.
wlierman
Depends on what you're doing. Overall, I usually modify my code, then I have a history of what's been doine.
ods excel file = "path to your excel file" style = meadow;
proc freq code.....
ods excel close;
In EG, you can right click a file and get it to save to Excel as well.
https://blogs.sas.com/content/sgf/2019/04/23/ods-excel-control/
Other ways are listed in this post:
https://blogs.sas.com/content/sasdummy/2012/02/11/export-excel-methods/
@wlierman wrote:
I have the following results from proc freq tables statement. I will give just a couple lines like:
Age Grouping
County 0-9 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80 and Above Total
Baker 31 14 25 23 12 16 22 13 0 156
Benton 49 141 250 74 46 47 33 7 9 656
. . . . .
My question is what is the easiest way I can export the table from the Results Viewer into Excel.
Thank you.
wlierman
Use the ODS destination to direct output:
ods excel file="c:\folder\my.xlsx"; <proc print goes here> ods excel close;
If you don't have the license to use ODS excel you can use ods TAGSETS.excelxp and create an XML file that excel should be able to open.
Since the results is generally HTML it is not actually Excel content.
Depends on what you're doing. Overall, I usually modify my code, then I have a history of what's been doine.
ods excel file = "path to your excel file" style = meadow;
proc freq code.....
ods excel close;
In EG, you can right click a file and get it to save to Excel as well.
https://blogs.sas.com/content/sgf/2019/04/23/ods-excel-control/
Other ways are listed in this post:
https://blogs.sas.com/content/sasdummy/2012/02/11/export-excel-methods/
Thank you Reeza. Both you and ballardw zeroed in on the method.
I appreciate the extra material that you included in your response.
Take care.
wlierman
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.