SAS Frequency Tabulations and Contingency Tables (Crosstabs)



SAS Oneway Frequency Tabulations and Twoway Contingency Tables (Crosstabs)

/***********************************************************

This example illustrates:

How to create user-defined formats

How to recode continuous variables into ordinal categories

How to generate oneway and twoway tables and basic tests

The following tests are illustrated:

Chi-square goodness of fit test

Binomial test of proportion for a two-level variable

Exact Binomial test

Pearson Chi-square test

Fisher’s exact test

Cochran-Armitage test for trend

Procs used:

Proc Format

Proc Means

Proc Freq

Proc Contents

Filename: frequencies.sas

************************************************************/

OPTIONS FORMCHAR="|----|+|---+=|-/\*";

OPTIONS NODATE PAGENO=1 FORMDLIM=" ";

PROC FORMAT;

VALUE AGEFMT 1 = "1:19-29"

2 = "2:30-39"

3 = "3:>39";

VALUE HIAGEFMT 1 = "1:AGE > 39"

2 = "2:AGE =240"

2 = "2:23"

2 = "2:BMI39";

NOTE: Format AGEFMT has been output.

8

9 VALUE HIAGEFMT 1 = "1: Age >39"

10 2 = "2: Age =240"

13 2 = "2: Chol 23"

27 2 = "2: BMI ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download