Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-sh8wx Total loading time: 0 Render date: 2024-07-18T23:27:20.480Z Has data issue: false hasContentIssue false

Chapter 6 - Procedures for Simple Statistics

Published online by Cambridge University Press:  05 June 2016

Julie Kezik
Affiliation:
Yale School of Public Health
Melissa Hill
Affiliation:
Cd3 Inc., Austin, Texas
Get access

Summary

Most of the time, regular data reporting consists of simple statistics. Answers to questions like “how many?”, “what proportion?”, “what's the highest value?”, and “are those variables related?” commonly form the basis of such reporting. SAS provides a selection of procedures that are best used to answer these most basic questions in a way that is accurate, succinct, and simple. In this chapter, we discuss four procedures that are commonly used to create user-friendly reports that answer these questions: FREQUENCY, MEANS, UNIVARIATE, and CORR.

THE FREQUENCY PROCEDURE

Perhaps the simplest way to answer the question “how many” is to use the FREQUENCY procedure, typically referred to as PROC FREQ. This procedure tells the user how many observations carry each value of a particular variable by producing tabular or list-style frequency counts for all variables listed in the TABLES statement.

Let's use the sashelp dataset ‘cars’ to explore the ins and outs of PROC FREQ. Example 6.1 shows simple syntax for executing PROC FREQ with one variable. In cases where more than one variable is included in the TABLES statement (Example 6.2), the output includes separate frequency listings for each variable, like the ones in Figure 6.1.

EXAMPLE 6.1. FREQUENCY Procedure Syntax.

proc freq data = sashelp.cars;

tables type;

run;

EXAMPLE 6.2. FREQUENCY Procedure Syntax with Two Variables.

proc freq data = sashelp.cars;

tables type drivetrain;

run;

The output shown in Figure 6.1 provides information about the variable ‘type.’ The first column of information tells us that there are six distinct values for this variable: ‘hybrid,’ ‘SUV,’ and so on. The Frequency column tells us how many observations carry each variable value, while the Percent column indicates the percentage of observations that carry each variable value. For instance, when we look at the row of information for variable value ‘SUV’, we see that there are 60 observations with this value and that those observations make up 14.02% of our data. The last two columns provide cumulative information; there are 63 observations with variable values ‘Hybrid’ or ‘SUV’, which make up 14.72% of our data. This information is especially useful in instances where the categorical values are sequential in some way, such as levels of disease severity, income, and so forth.

As with most procedures, there are a handful of options that allow the user to manipulate the appearance of the output.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2016

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×