FREQ

Purpose

Computes frequency tables for categorical variables. These tables contain counts or weighted counts (sums) in each cell.

Syntax

FREQ clist1  { ; { BY clist2 } { WEIGHT vname } }  @

Arguments and Subcommands

clist1

Categorical variables used to define the table(s). If the list contains only one variable and no weight variable is specified, a simple table of frequencies for each level of the variable is produced. If the list contains two or more variables, a series of two-way tables is produced by crossing the first variable in the list with each of the other variables in the list. If BY variables are given, separate tables are printed for each category defined by a cross-classification of the BY variables. If additional subcommands are given, the list should be terminated with a semicolon, (;).

BY clist2

Categorical variables used to define strata for which tables are to be printed. Separate tables are printed for each combination of variable categories in clist2 to make three-way or more tables. The limit on the number of BY variables is 10.

WEIGHT vname

The weight variable. Only those records with positive weights are included in the table. When this option is specified, table entries are sums of the weight variables. The sums are rounded to the nearest integer for printing. The SUM command should be used to produce tables of non-integer sums. WGT may be used in place of WEIGHT if desired.

Remarks

The tables produced by this command include row, column and total percentages. Only records in the currently active subset are included in the computation of the frequency tables.

Examples

a)  Compute a simple one way frequency table for sex:

FREQ sex @

b)  To compute a two-way table of counts classified by sex and city with the fatrisk variable used as weights. If the data set is a table and fatrisk contains the number of people in each cell of the table, this command will produce the distribution of the number of people in each cell. (If by mistake, the weight variable were to be omitted, the output would be the rather uninteresting table of counts of the number of cells for each sex, city combination.)

FREQ sex city; WEIGHT fatrisk @

c)  To extend the previous example to a three way table of counts classified by sex, city, and agexgrp:

FREQ sex city; WEIGHT fatrisk BY agexgrp @

d)  To compute sex by city and sex by agexgrp count tables:

FREQ sex city agexgrp; WEIGHT fatrisk @