bas 150 lesson 7 lecture

37
BAS 150 Lesson 7: SAS Reporting Procs and Descriptive Statistics

Upload: wake-tech-bas

Post on 14-Apr-2017

31 views

Category:

Education


0 download

TRANSCRIPT

Page 1: BAS 150 Lesson 7 Lecture

BAS 150Lesson 7: SAS Reporting Procs and Descriptive Statistics

Page 2: BAS 150 Lesson 7 Lecture

• Utilize SAS Procs for reporting

• Incorporate descriptive statistics in reports

• Effectively export charts and data

This Lesson’s Learning Objectives

Page 3: BAS 150 Lesson 7 Lecture

PROC Freq

o Options

o Using formats

o Missing data

o Order=

o Multi-dimensional tables

o Statistics

Topics (1 of 2)

Page 4: BAS 150 Lesson 7 Lecture

PROC Means

o Options

o Class statement

o Missing data

o Output statement

o _TYPE_ and Chartype

ODS NOPROCTITLE

Topics (2 of 2)

Page 5: BAS 150 Lesson 7 Lecture

PROC Freq can be used to run simple

frequency tables on your data

PROC Freq (1 of 4)

Page 6: BAS 150 Lesson 7 Lecture

PROC Freq (2 of 4)

Results of PROC Freq of “Demographics”

Page 7: BAS 150 Lesson 7 Lecture

Use the table statement to only print selected variables

Use the nocum option to suppress cumulative statistics

Use the nopercent option to suppress percent statistics

Can use options together or separately

PROC Freq (3 of 4)

Page 8: BAS 150 Lesson 7 Lecture

where statement – Only include selected observations

format statement – Apply format to selected variables

o Only applies to current procedure

o Can be used to group data

PROC Freq (4 of 4)

Page 9: BAS 150 Lesson 7 Lecture

Use formats to group data

Using Formats

Page 10: BAS 150 Lesson 7 Lecture

Missing data will be excluded from the analysis

Will affect percent calculations

Missing Data (1 of 2)

Page 11: BAS 150 Lesson 7 Lecture

Use the missing option to include missing values in the frequency table

Can also create a label for missing values in your PROC Format

Missing Data (2 of 2)

Page 12: BAS 150 Lesson 7 Lecture

By default PROC Freq orders your frequency table based on the

internal (unformatted) values

Use the order= option to change the order

o internal: (Default) Order values by their internal (unformatted) values

o formatted: Order values by their formatted values

o freq: Order values from the most to least frequent

o data: Order values based on their order in the input dataset

Missing values, if included in the table, will always be listed first

regardless

Order= (1 of 2)

Page 13: BAS 150 Lesson 7 Lecture

Order= (2 of 2)

Page 14: BAS 150 Lesson 7 Lecture

Can create simple cross-tabulations

Multi-Dimension Tables (1 of 4)

Page 15: BAS 150 Lesson 7 Lecture

Use the nocol option to suppress column percent statistics

Use the norow option to suppress row percent statistics

Use the nopercent option to suppress total percent statistics

Can use options together or separately

Multi-Dimension Tables (2 of 4)

Page 16: BAS 150 Lesson 7 Lecture

Use the list option to display cross-tab tables in a list

format

Multi-Dimension Tables (3 of 4)

Page 17: BAS 150 Lesson 7 Lecture

There are multiple ways to request tables:

Multi-Dimension Tables (4 of 4)

Notation Resulttable A * (B C D); Three tables: A by B; A by C; A by D

table (A B) * (C D); Four tables: A by C; A by D; B by C; B by D

table A * B * C; One three-way table with the format Page * Row * Column. Each classification of A would appear on a separate page.

table Ques1 - Ques10; Ten tables, one each for Ques1 through Ques10

table VarA -- VarB; One table each for all variables between VarA and VarB in the SAS dataset (by varnum)

table Ques: ; One table each for all variables that begin with “Ques”

table _numeric_; One table each for all numeric variables

table _character_; One table each for all character variables

table _all_; One table each for all variables

Page 18: BAS 150 Lesson 7 Lecture

PROC Freq is also

used to calculate

certain statistics, such

as chi-square, odds

ratio, and relative risk

Statistics

Page 19: BAS 150 Lesson 7 Lecture

PROC Means can be used to run simple

summary statistics on your data

PROC Means (1 of 5)

Page 20: BAS 150 Lesson 7 Lecture

Results of PROC Means of “Demographics”

PROC Means (2 of 5)

Page 21: BAS 150 Lesson 7 Lecture

Many options to control output of PROC Means

o NMiss Mean Median – Examples of statistics that can be specified

in PROC Means

(see later slide for list of statistical keywords)

o class statement – Allows for grouping by categorical variables

o var statement – Only provides statistics for listed analysis variables

PROC Means (3 of 5)

Page 22: BAS 150 Lesson 7 Lecture

Statistics available in PROC Means

PROC Means (4 of 5)

Page 23: BAS 150 Lesson 7 Lecture

maxdec= option – Specifies the number of decimal

places for statistics

where statement – Only include selected observations

format statement – Apply format to selected variables

o Only applies to current procedure

o Can be used to group class data

PROC Means (5 of 5)

Page 24: BAS 150 Lesson 7 Lecture

Table can also include multiple class variables

Class Variables (1 of 2)

Page 25: BAS 150 Lesson 7 Lecture

Table can also include multiple class variables

Class Variables (2 of 2)

Page 26: BAS 150 Lesson 7 Lecture

Where Default OverrideAnalysis variable Excludes that observation from

the calculation of statisticsNone

Class variable Excludes that observation from the table

MISSING option

Missing Data

Includes selected

class variables

with missing

data

Includes all class variables with

missing data

Page 27: BAS 150 Lesson 7 Lecture

Create output datasets using the output statement

out= specifies the name of the output dataset(s)

By default, the output dataset will include N, Mean, Min, Max, and

Std. Dev – regardless of which statistics you specify in the PROC

Means statement – for all levels of your class variable(s)

Output Statement (1 of 7)

Page 28: BAS 150 Lesson 7 Lecture

Lesson:

If an observation is missing data for a class

variable, that observation is excluded from all

analyses in the procedure

Output Statement (2 of 7)

Page 29: BAS 150 Lesson 7 Lecture

You can specify which statistics to include

through the output statement

Output Statement (3 of 7)

StatisticNew

variable name

Page 30: BAS 150 Lesson 7 Lecture

Use the autoname function to automatically

generate new variable names

Output Statement (4 of 7)

Page 31: BAS 150 Lesson 7 Lecture

If you forget to name your variables, your output will

not run correctly

Output Statement (5 of 7)

Page 32: BAS 150 Lesson 7 Lecture

Can assign different statistics to each variable

Output Statement (6 of 7)

Page 33: BAS 150 Lesson 7 Lecture

Can have multiple output statements with

different specifications for each dataset

Output Statement (7 of 7)

Page 34: BAS 150 Lesson 7 Lecture

Some procedures (such as FREQ and MEANS) will

print a procedure title at the top of their output

o This cannot be controlled by title statements

ODS

Page 35: BAS 150 Lesson 7 Lecture

Use an ODS NOPROCTITLE statement to

turn off the procedure titles

ODS NOPROCTITLE

Page 36: BAS 150 Lesson 7 Lecture

• Utilize SAS Procs for reporting

• Incorporate descriptive statistics in reports

• Effectively export charts and data

Summary - Learning Objectives

Page 37: BAS 150 Lesson 7 Lecture

“This workforce solution was funded by a grant awarded by the U.S. Department of Labor’s

Employment and Training Administration. The solution was created by the grantee and does not

necessarily reflect the official position of the U.S. Department of Labor. The Department of Labor

makes no guarantees, warranties, or assurances of any kind, express or implied, with respect to such

information, including any information on linked sites and including, but not limited to, accuracy of the

information or its completeness, timeliness, usefulness, adequacy, continued availability, or

ownership.”

Except where otherwise stated, this work by Wake Technical Community College Building Capacity in

Business Analytics, a Department of Labor, TAACCCT funded project, is licensed under the Creative

Commons Attribution 4.0 International License. To view a copy of this license, visit

http://creativecommons.org/licenses/by/4.0/

Copyright Information