PROC FREQ - SAS Halifax Regional User Group | Share

Download Report

Transcript PROC FREQ - SAS Halifax Regional User Group | Share

PROC FREQ
SHRUG November 28, 2014
1
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
SHRUG November 28, 2014
2
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;
SHRUG November 28, 2014
3
Just How Simple is it?
Proc freq;
Run;
Proc freq data=mydata1;
Tables _all_;
or Tables _CHAR_;
Run;
SHRUG November 28, 2014
4
SHRUG November 28, 2014
5
Options
PROC FREQ;
NLEVELS – Number of variable levels
new back in version 9
ORDER=
– DATA|FORMATTED|FREQ|INTERNAL
SHRUG November 28, 2014
6
SHRUG November 28, 2014
7
Formatting Options
TABLES variables/ options;
• 1-way, 2-way to n–way tables
• MISSPRINT, MISSING
• CROSSLIST, LIST,
• NOCOL, NOCUM, NOROW, NOFREQ, CUMCOL
SHRUG November 28, 2014
8
Example
Proc freq data=mydata1;
Tables sex*health/nocum norow nopercent;
Run;
Proc freq data=mydata1;
Tables sex*health/crosslist;
Run;
SHRUG November 28, 2014
9
SHRUG November 28, 2014
10
SHRUG November 28, 2014
11
SHRUG November 28, 2014
12
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;
SHRUG November 28, 2014
13
SHRUG November 28, 2014
14
SHRUG November 28, 2014
15
Statistical Computations
SHRUG November 28, 2014
16
Statistical Computations
Proc freq data=mydata1;
Where racer ne 3;/*excludes where race=other*/
Tables sex*racer/chisq agree measures nowarn;
Run;
SHRUG November 28, 2014
17
Statistical Computations
SHRUG November 28, 2014
18
SHRUG November 28, 2014
19
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
SHRUG November 28, 2014
20
New in SAS 9.3
•Exact conditional Confidence Limits for Risk
Difference and Relative Risk
•Maxlevels
SHRUG November 28, 2014
21
New in SAS 9.4
• MIDP - mid-p-values for exact tests
only 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
SHRUG November 28, 2014
22
Kara Thompson
Research Methods Unit,
Department of Medicine, Dalhousie University
902-473 -2094
[email protected]
SHRUG November 28, 2014
23