Upload
wake-tech-bas
View
30
Download
0
Embed Size (px)
Citation preview
BAS 150Lesson 7: SAS Reporting Procs and Descriptive Statistics
• Utilize SAS Procs for reporting
• Incorporate descriptive statistics in reports
• Effectively export charts and data
This Lesson’s Learning Objectives
PROC Freq
o Options
o Using formats
o Missing data
o Order=
o Multi-dimensional tables
o Statistics
Topics (1 of 2)
PROC Means
o Options
o Class statement
o Missing data
o Output statement
o _TYPE_ and Chartype
ODS NOPROCTITLE
Topics (2 of 2)
PROC Freq can be used to run simple
frequency tables on your data
PROC Freq (1 of 4)
PROC Freq (2 of 4)
Results of PROC Freq of “Demographics”
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)
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)
Use formats to group data
Using Formats
Missing data will be excluded from the analysis
Will affect percent calculations
Missing Data (1 of 2)
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)
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)
Order= (2 of 2)
Can create simple cross-tabulations
Multi-Dimension Tables (1 of 4)
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)
Use the list option to display cross-tab tables in a list
format
Multi-Dimension Tables (3 of 4)
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
PROC Freq is also
used to calculate
certain statistics, such
as chi-square, odds
ratio, and relative risk
Statistics
PROC Means can be used to run simple
summary statistics on your data
PROC Means (1 of 5)
Results of PROC Means of “Demographics”
PROC Means (2 of 5)
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)
Statistics available in PROC Means
PROC Means (4 of 5)
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)
Table can also include multiple class variables
Class Variables (1 of 2)
Table can also include multiple class variables
Class Variables (2 of 2)
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
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)
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)
You can specify which statistics to include
through the output statement
Output Statement (3 of 7)
StatisticNew
variable name
Use the autoname function to automatically
generate new variable names
Output Statement (4 of 7)
If you forget to name your variables, your output will
not run correctly
Output Statement (5 of 7)
Can assign different statistics to each variable
Output Statement (6 of 7)
Can have multiple output statements with
different specifications for each dataset
Output Statement (7 of 7)
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
Use an ODS NOPROCTITLE statement to
turn off the procedure titles
ODS NOPROCTITLE
• Utilize SAS Procs for reporting
• Incorporate descriptive statistics in reports
• Effectively export charts and data
Summary - Learning Objectives
“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