### Download Presentation

One and Two-Way Frequency Tables Using PROC FREQ

**An Image/Link below is provided (as is) to download presentation**
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

#### Presentation Transcript

**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 < options > ;
BY variables ;
EXACT statistic-options < / computation-options > ;
OUTPUT < OUT=SAS-data-set > options ;
TABLES requests < / options > ;
TEST options ;
WEIGHT variable < / option > ;
No var or class statement.

**4. **The FREQ Procedure Default behavior…
proc freq data=stt305.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 data=stt305.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.
Using these formats:
proc format;
value lake
1='Oligotrophic'
2='Eutrophic'
3='Mesotrophic'
;
value dam
1='Yes'
0='No'
;
value safety
low-<0.5='Safe'
0.5-<1.0='Unsafe'
1.0-high='Dangerous'
;
run;

**8. **Using Formats With this code:
proc freq data=stt305.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 data=stt305.fish;
table lt*hg;
format lt lake. hg safety.;
run;

**10. **Two-Way tables

**11. **Two-Way tables

**12. **Two-Way tables

**13. **Two-Way tables

**14. **Three-Way Tables Consider
proc freq data=stt305.fish;
table dam*lt*hg;
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