Specifying Variables in PROC FREQ

TABLES Statement Syntax

By default, the FREQ procedure creates frequency tables for every variable in a data set. But this is not always what you want. A variable that has continuous numeric values (such as DateTime) can result in a lengthy and meaningless table. Likewise, a variable that has a unique value for each observation (such as FullName) is unsuitable for PROC FREQ processing. Frequency distributions work best with variables whose values are categorical, and whose values are better summarized by counts rather than by averages.
To specify the variables to be processed by the FREQ procedure, include a TABLES statement.
Syntax, TABLES statement:
TABLES variable(s);
variable(s) lists the variables to include.

Example: Determining the Report Layout

The order in which the variables appear in the TABLES statement determines the order in which they are listed in the PROC FREQ report.
Consider the SAS data set Finance.Loans. The variables Rate and Months are categorical variables, so they are the best choices for frequency tables.
Figure 9.13 PROC PRINT Report of the Data Set Finance.Loans
PROC PRINT Report of the Data Set Finance.Loans
proc freq data=finance.loans; 
   tables rate months; 
run;
Figure 9.14 Frequency Tables for Rate and Months
Frequency Tables for Rate and Months
In addition to listing variables separately, you can use a numbered range of variables.
proc freq data=perm.survey; 
   tables item1-item3; 
run;
Figure 9.15 Frequency Tables for Item1–Item3
Frequency Tables for Item1–Item3
Tip
To suppress the display of cumulative frequencies and cumulative percentages in one-way frequency tables and in list output, add the NOCUM option to your TABLES statement. Here is the syntax:
TABLES variable(s) / NOCUM;
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.54.168