SAS author's tip: Using PROC FREQ to export descriptive statistics

1

This week's SAS author's tip comes from Jack Shostak - manager of statistical programming at the Duke Clinical Research Institute. Despite his youthful appearance, Jack's been using SAS since 1985 and is the author of SAS Programming in the Pharmaceutical Industry and coauthor of Common Statistical Methods for Clinical Research with SAS Examples, Third Edition.

When selecting a tip from SAS Programming in the Pharmaceutical Industry today, I noticed the number of stellar user reviews for the work. I particularly like these lines from Tim Moore, President of Quality Research Partner: "Consider this book the Ultimate Guided Expedition for Clinical Trial Programmers. This will keep new folks "out of trouble" and give the seasoned professional something new to consider."

Hopefully this week's tip will also keep you out of trouble-or get you out of trouble.

The following excerpt is from SAS Press author Jack Shostak's book "SAS Programming in the Pharmaceutical Industry" Copyright © 2005,  SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software

Using PROC FREQ to Export Descriptive Statistics

PROC FREQ can be used to export frequencies of categorical data simply by specifying the OUT= option in the TABLES statement like this:

The resulting “freqs” data set contains the BY variable “trt,” “a,” “b,” and the cell frequency “count” and percentage “percent” variables. Row and column percentages can be added to the output data set by specifying the OUTPCT option. If you also want the “totals” row and column that you see in your PROC FREQ listing output, you can use ODS to export that to a data set called “freqs”:

Remember that if you do not want to exclude missing values from your counts or from the denominators of your percentage calculations, you need to specify the MISSING option in your TABLES statement.

Read more about Jack Shostak, his work, free chapters from his books, and user reviews on his author page!

Share

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

1 Comment

  1. Pingback: SAS author’s tip: Define variables once - The SAS Bookshelf

Leave A Reply

Back to Top