Help using Base SAS procedures

Saving Frequency Tables in Excel

Reply
Contributor spg
Contributor
Posts: 61

Saving Frequency Tables in Excel

Can frequency tables (displayed in the output window) be saved as excel files? I can't export these tables, and I can't copy-paste them on to an excel file as the format gets all garbled.

Suggestions will be appreciated.
N/A
Posts: 0

Re: Saving Frequency Tables in Excel

I'm interesting if there is a better way to do this, I create the results in HTLM (under tools, options, preferences) and then copy and paste into excel
Super Contributor
Posts: 394

Re: Saving Frequency Tables in Excel

You can use ODS to save procedure output in Excel format. Here's some documentation: http://support.sas.com/rnd/base/ods/excel/index.html.
Contributor spg
Contributor
Posts: 61

Re: Saving Frequency Tables in Excel

Thanks! i have been reading the documentation, but have not been able to successfully export the tables.

i use the html procedure as well, but it garbles the format.
Super Contributor
Posts: 394

Re: Saving Frequency Tables in Excel

If you describe the problem you're encountering and post some code to demonstrate the problem, somebody on this forum may be able to offer a suggestion.
Contributor
Posts: 33

Re: Saving Frequency Tables in Excel

A couple of things you might consider are outputting to a data set and then you can export that data set to Excel. What you would do is this:

proc freq data=lib.test ;
table var1 / out=list.test1;
run;

Your new data set would have three variables: var1, count, and percent. This is fine for a single variable frequency. If you do a by- frequency, then you'd get a more complex data set.

One thing that I've had good luck with in copy/pasting single frequency tables from the output window is using the Excel feature of Data / Text-to-Columns. It takes a little playing around with to get it to break just right, but it's pretty forgiving.

Good luck.
Contributor spg
Contributor
Posts: 61

Re: Saving Frequency Tables in Excel

Thanks stateworker. Your tip was very useful!
I have used the Text to Columns feature before....but I was having trouble doing the same for the frequency tables.
Ask a Question
Discussion stats
  • 6 replies
  • 5457 views
  • 0 likes
  • 4 in conversation