This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: STAT 475 Chapter 9 PRODUCING FREQUENCY TABLES The PROC FREQ may be used to create a one-way frequency table that reports the number (frequency) of observations for each value of a categorical variable. That is, the one-way frequency table contains the frequency distribution . By default, the PROC FREQ reports frequency count , percentage , cumulative frequency , and cumulative percentage for each value of a variable. Example. Ten people were treated for glaucoma. Their sex, race, and response to the treatment (yes or no) were recorded. The following code produces a one-way frequency table for the three categorical variables in the data set. data glaucoma; input Sex $ Race $ Response $ @@; datalines; female white yes male white yes male black no male hispanic no female hispanic yes male white yes male black yes male white no female black yes female white no ; proc freq; run; The output is The FREQ Procedure Cumulative Cumulative Sex Frequency Percent Frequency Percent female 4 40.00 4 40.00 male 6 60.00 10 100.00 Cumulative Cumulative Race Frequency Percent Frequency Percent black 3 30.00 3 30.00 hispanic 2 20.00 5 50.00 white 5 50.00 10 100.00 Cumulative Cumulative Response Frequency Percent Frequency Percent no 4 40.00 4 40.00 yes 6 60.00 10 100.00 To specify the variables to be processed by the FREQ procedure, use the TABLES statement. The syntax is 1 proc freq; tables variable1 variable2 ; run; Example. In the glaucoma example, to compute the frequency distribution for Sex and Response only, use the following code proc freq ; tables Sex Response; run ; The output is The FREQ Procedure Cumulative Cumulative Sex Frequency Percent Frequency Percent female 4 40.00 4 40.00 male 6 60.00 10 100.00 Cumulative Cumulative Response Frequency Percent Frequency Percent...
View Full Document
- Fall '11