One and Two-Way Frequency Tables Using PROC FREQ STT 305 The - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

One and Two-Way Frequency Tables Using PROC FREQ STT 305 The

Description:

One and Two-Way Frequency Tables Using PROC FREQ STT 305 The FREQ Procedure FREQ is used to construct frequency tables (count/percentage) for variables in a data set. – PowerPoint PPT presentation

Number of Views:255
Avg rating:3.0/5.0
Slides: 20
Provided by: peopleUnc48
Category:
Tags: freq | proc | stt | frequency | one | tables | two | using | way

less

Transcript and Presenter's Notes

Title: One and Two-Way Frequency Tables Using PROC FREQ STT 305 The


1
One and Two-Way Frequency Tables Using PROC FREQ
  • STT 305

2
The FREQ Procedure
  • FREQ is used to construct frequency tables
    (count/percentage) for variables in a data set.
  • Tables may include from one to three variables
  • FREQ can also produce tests for
    independence/association.

3
The FREQ Procedure
  • General Syntax
  • PROC FREQ lt options gt
  • BY variables
  • EXACT statistic-options lt / computation-options gt
  • OUTPUT lt OUTSAS-data-set gt options
  • TABLES requests lt / options gt
  • TEST options
  • WEIGHT variable lt / option gt
  • No var statement.

4
The FREQ Procedure
  • Default behavior
  • proc freq datastt305.fish
  • run
  • is to give a frequency table for every variable
    in the data set.
  • Each variable is taken as a classification
    variable, i.e. each distinct value is taken as a
    separate category.

5
The Table Statement
  • The table statement is like the var statement in
    that it selects variables for analysis however,
    it will also affect the structure of the
    table(s).
  • This case
  • proc freq datastt305.fish
  • table lt dam
  • run

6
The Table Statement
  • Produces a table for both dam and lake type

7
Using Formats
  • Formats are recognized for any variable listed in
    the table statement and classes are constructed
    based on formatted values.
  • Using these formats
  • proc format
  • value lake
  • 1'Oligotrophic'
  • 2'Eutrophic'
  • 3'Mesotrophic'
  • value dam
  • 1'Yes'
  • 0'No'
  • value safety
  • low-lt0.5'Safe'
  • 0.5-lt1.0'Unsafe'
  • 1.0-high'Dangerous'
  • run

8
Using Formats
  • With this code
  • proc freq datastt305.fish
  • table lt dam hg
  • format lt lake. dam dam. hg safety.
  • run
  • Produces

9
Two-Way tables
  • The operator can be used in the table statement
    to create a two dimensional table.
  • Consider
  • proc freq datastt305.fish
  • table lthg
  • format lt lake. hg safety.
  • run

10
Two-Way tables
Legend for numbers in each cell
11
Two-Way tables
Ratio of these two
Percentage of the whole represented by this cell
12
Two-Way tables
Ratio of these two
Percentage of the row represented by this cell
13
Two-Way tables
Ratio of these two
Percentage of the column represented by this cell
14
Three-Way Tables
  • Consider
  • proc freq datastt305.fish
  • table damlthg
  • format lt lake. dam dam. hg safety.
  • run
  • Creates the two-way table for lake type and
    mercury for each level of dam (no yes).

15
Three-Way Tables
Three is the maximum number of variables that can
be used with the operator.
16
Practice Problems
  • Using the birthweight data and the following
  • Normal gestation is 259 days or more, less is
    premature (missing values are coded as 999)
  • Smoking status is coded as
  • 0, Never smoked
  • 1, Currently smoke
  • 2, Stopped smoking at pregnancy
  • 3, Stopped before current pregnancy
  • 9, Unknown
  • Create

17
Practice Problem 1
18
Practice Problem 2 (page 1)
19
Practice Problem 2 (page 2)
Write a Comment
User Comments (0)
About PowerShow.com