PROC FREQ 1SHRUG November 28, 2014. What good is Proc FREQ It Counts! Answers question how many...

Post on 21-Dec-2015

219 views 0 download

Tags:

Transcript of PROC FREQ 1SHRUG November 28, 2014. What good is Proc FREQ It Counts! Answers question how many...

PROC FREQ

1SHRUG November 28, 2014

What good is Proc FREQ

• It Counts! Answers question how many

• Display data (error checks), descriptive

• Analyze categorical data, statistical

• It is fast and easy

2SHRUG November 28, 2014

Syntax

PROC FREQ;BY variables;

EXACT statistic – options </computation-options>;

OUTPUT <OUT=SAS-data-set> output-options;

TABLES requests </options>;

TEST options;

WEIGHT variable </option>;

RUN;

3SHRUG November 28, 2014

Just How Simple is it?

Proc freq;Run;

Proc freq data=mydata1;Tables _all_; or Tables _CHAR_;Run;

4SHRUG November 28, 2014

5SHRUG November 28, 2014

Options

PROC FREQ;

NLEVELS – Number of variable levels

new back in version 9

ORDER=– DATA|FORMATTED|FREQ|INTERNAL

6SHRUG November 28, 2014

7SHRUG November 28, 2014

Formatting Options

TABLES variables/ options;

• 1-way, 2-way to n–way tables

• MISSPRINT, MISSING

• CROSSLIST, LIST, • NOCOL, NOCUM, NOROW, NOFREQ, CUMCOL

8SHRUG November 28, 2014

Example

Proc freq data=mydata1;Tables sex*health/nocum norow nopercent;Run;

Proc freq data=mydata1;Tables sex*health/crosslist;Run;

9SHRUG November 28, 2014

10SHRUG November 28, 2014

11SHRUG November 28, 2014

12SHRUG November 28, 2014

Proc freq data=mydata1;tables region*sex*health/nocum norow nopercent;run;

Proc sort data=mydata1;by region;run;Proc freq data=mydata1;by region;tables sex*health/nocum norow nopercent;run;

13SHRUG November 28, 2014

14SHRUG November 28, 2014

15SHRUG November 28, 2014

Statistical Computations

16SHRUG November 28, 2014

Statistical Computations

Proc freq data=mydata1;Where racer ne 3;/*excludes where race=other*/

Tables sex*racer/chisq agree measures nowarn;Run;

17SHRUG November 28, 2014

Statistical Computations

18SHRUG November 28, 2014

19SHRUG November 28, 2014

EXACT

• Alternative to asymptotic p-values (sparse, skewed or heavily tied data)

• Computed using network algorithms• Monte Carlo estimation also available

POINT – exact probability that test statistic equals the observed value

20SHRUG November 28, 2014

New in SAS 9.3•Exact conditional Confidence Limits for Risk Difference and Relative Risk

•Maxlevels

21SHRUG November 28, 2014

New in SAS 9.4

• MIDP - mid-p-values for exact testsonly half of probability of observed sample is included in tail

• Score confidence limits for Odds ratio and Relative Risk

• Supports Baher, exact mid-p, likelihood ratio and logit binomial confidence limits

22SHRUG November 28, 2014

Kara ThompsonResearch Methods Unit, Department of Medicine, Dalhousie University902-473 -2094kara.thompson@dal.ca

SHRUG November 28, 2014 23