Basic Concepts #6: Introduction to Report Writing

Similar documents
Report Customization Using PROC REPORT Procedure Shruthi Amruthnath, EPITEC, INC., Southfield, MI

Counting the Ways to Count in SAS. Imelda C. Go, South Carolina Department of Education, Columbia, SC

Using the COMPUTE Block in PROC REPORT Jack Hamilton, Kaiser Foundation Health Plan, Oakland, California

PROC MEANS: More than just your average procedure

PROC REPORT: How To Get Started

Appendix III: SPSS Preliminary

Performing Queries Using PROC SQL (1)

Paper Advanced Tips and Techniques with PROC MEANS. Andrew H. Karp Sierra Information Services, Inc. Sonoma, California USA

PROC SUMMARY Options Beyond the Basics Susmita Pattnaik, PPD Inc, Morrisville, NC

Data exploration with Microsoft Excel: analysing more than one variable

4 Other useful features on the course web page. 5 Accessing SAS

Creating Word Tables using PROC REPORT and ODS RTF

This can be useful to temporarily deactivate programming segments without actually deleting the statements.

Preparing your data for analysis using SAS. Landon Sego 24 April 2003 Department of Statistics UW-Madison

Categorical Variables

From The Little SAS Book, Fifth Edition. Full book available for purchase here.

Handling Missing Values in the SQL Procedure

SAS: A Mini-Manual for ECO 351 by Andrew C. Brod

Dongfeng Li. Autumn 2010

EXST SAS Lab Lab #4: Data input and dataset modifications

Data exploration with Microsoft Excel: univariate analysis

Salary. Cumulative Frequency

Graphing in SAS Software

The HPSUMMARY Procedure: An Old Friend s Younger (and Brawnier) Cousin Anh P. Kellermann, Jeffrey D. Kromrey University of South Florida, Tampa, FL

Guido s Guide to PROC FREQ A Tutorial for Beginners Using the SAS System Joseph J. Guido, University of Rochester Medical Center, Rochester, NY

ICP Data Validation and Aggregation Module Training document. HHC Data Validation and Aggregation Module Training Document

ODS for PRINT, REPORT and TABULATE

Survey Analysis: Options for Missing Data

PES Institute of Technology-BSC QUESTION BANK

Create Custom Tables in No Time

Two Correlated Proportions (McNemar Test)

Utilizing Clinical SAS Report Templates Sunil Kumar Gupta Gupta Programming, Thousand Oaks, CA

Beyond the Basics: Advanced REPORT Procedure Tips and Tricks Updated for SAS 9.2 Allison McMahill Booth, SAS Institute Inc.

An introduction to using Microsoft Excel for quantitative data analysis

Beginning Tutorials. PROC FREQ: It s More Than Counts Richard Severino, The Queen s Medical Center, Honolulu, HI OVERVIEW.

Taming the PROC TRANSPOSE

How to Use a Data Spreadsheet: Excel

Utilizing Clinical SAS Report Templates with ODS Sunil Kumar Gupta, Gupta Programming, Simi Valley, CA

SECTION 2-1: OVERVIEW SECTION 2-2: FREQUENCY DISTRIBUTIONS

Data Cleaning 101. Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ. Variable Name. Valid Values. Type

Anyone Can Learn PROC TABULATE

Microsoft Excel 2010 Part 3: Advanced Excel

MBA 611 STATISTICS AND QUANTITATIVE METHODS

Microsoft Excel 2007 Mini Skills Overview of Tables

Dashboard Object Types. Modified: May, 2013 Version 1.0

Ad Hoc Advanced Table of Contents

INTRODUCTION TO EXCEL

2. Filling Data Gaps, Data validation & Descriptive Statistics

Christianna S. Williams, University of North Carolina at Chapel Hill, Chapel Hill, NC

Evaluating the results of a car crash study using Statistical Analysis System. Kennesaw State University

INTRODUCTION TO SPSS FOR WINDOWS Version 19.0

Creating QBE Queries in Microsoft SQL Server

9.1 SAS. SQL Query Window. User s Guide

Bill Burton Albert Einstein College of Medicine April 28, 2014 EERS: Managing the Tension Between Rigor and Resources 1

Online EFFECTIVE AS OF JANUARY 2013

MEASURES OF LOCATION AND SPREAD

How Does My TI-84 Do That

Quick Start to Data Analysis with SAS Table of Contents. Chapter 1 Introduction 1. Chapter 2 SAS Programming Concepts 7

3.GETTING STARTED WITH ORACLE8i

SAS Software to Fit the Generalized Linear Model

B) Mean Function: This function returns the arithmetic mean (average) and ignores the missing value. E.G: Var=MEAN (var1, var2, var3 varn);

An Introduction to SPSS. Workshop Session conducted by: Dr. Cyndi Garvan Grace-Anne Jackman

IBM SPSS Statistics 20 Part 1: Descriptive Statistics

Excel: Analyze PowerSchool Data

Basic Statistical and Modeling Procedures Using SAS

Chapter 63 The SURVEYSELECT Procedure

Data Analysis Tools. Tools for Summarizing Data

In This Issue: Excel Sorting with Text and Numbers

User Manual - Sales Lead Tracking Software

Lecture 2 ESTIMATING THE SURVIVAL FUNCTION. One-sample nonparametric methods

Bowerman, O'Connell, Aitken Schermer, & Adcock, Business Statistics in Practice, Canadian edition

Using PROC RANK and PROC UNIVARIATE to Rank or Decile Variables

SOAL-SOAL MICROSOFT EXCEL 1. The box on the chart that contains the name of each individual record is called the. A. cell B. title C. axis D.

Basic Excel Handbook

Chapter 1 Overview of the SQL Procedure

An Introduction to Excel Pivot Tables

Minitab Session Commands

Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY

Use of the Chi-Square Statistic. Marie Diener-West, PhD Johns Hopkins University

HOW TO COLLECT AND USE DATA IN EXCEL. Brendon Riggs Texas Juvenile Probation Commission Data Coordinators Conference 2008

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

Histogram of Numeric Data Distribution from the UNIVARIATE Procedure

Instruction Manual for SPC for MS Excel V3.0

INTERPRETING THE ONE-WAY ANALYSIS OF VARIANCE (ANOVA)

COMPUTER SCIENCE. Paper 1 (THEORY)

Text Analytics Illustrated with a Simple Data Set

How to Color Your Report? By Xuefeng Yu, Celgene Co., Summit, NJ

INTERMEDIATE Excel 2013

Descriptive Statistics

10CS35: Data Structures Using C

SPSS Notes (SPSS version 15.0)

VI. Introduction to Logistic Regression

SPSS: Getting Started. For Windows

Computer Training Centre University College Cork. Excel 2013 Pivot Tables

STATISTICA Formula Guide: Logistic Regression. Table of Contents

IBM SPSS Direct Marketing 23

Using Excel 2003 with Basic Business Statistics

Post Processing Macro in Clinical Data Reporting Niraj J. Pandya

LAB 4 INSTRUCTIONS CONFIDENCE INTERVALS AND HYPOTHESIS TESTING

ACL Command Reference

Transcription:

Basic Concepts #6: Introduction to Report Writing Using By-line, PROC Report, PROC Means, PROC Freq JC Wang wang (WMU) Basic Concepts 6 Lecture 8 1 / 27

Outline 1 Use of Byline Information in Title Lines By-Group Processing 2 PROC Report Use of PROC Report PROC REPORT Statement Selected Statements Used in PROC Report 3 PROC Means Comparing PROC Means and PROC Summary Understanding the Use of Variables in PROC Means Available Statistics in PROC Means Creating SAS Data Set with PROC Means 4 PROC Freq The Use of PROC Freq PROC FREQ Statement Statements Used in PROC Freq wang (WMU) Basic Concepts 6 Lecture 8 2 / 27

By-Group Processing By-group processing in a procedure step, a BY line identifies each group in SAS output. By-group processing information can be inserted into titles. PROC PRINT, PROC MEANS/PROC SUMMARY and PROC STANDARD, each requires suppressing default BY lines by setting NOBYLINE system option. Set system option BYLINE to resume default by-group processing. wang (WMU) Basic Concepts 6 Lecture 8 3 / 27

By-Group Processing By-group processing in a procedure step, a BY line identifies each group in SAS output. By-group processing information can be inserted into titles. PROC PRINT, PROC MEANS/PROC SUMMARY and PROC STANDARD, each requires suppressing default BY lines by setting NOBYLINE system option. Set system option BYLINE to resume default by-group processing. wang (WMU) Basic Concepts 6 Lecture 8 3 / 27

By-Group Processing By-group processing in a procedure step, a BY line identifies each group in SAS output. By-group processing information can be inserted into titles. PROC PRINT, PROC MEANS/PROC SUMMARY and PROC STANDARD, each requires suppressing default BY lines by setting NOBYLINE system option. Set system option BYLINE to resume default by-group processing. wang (WMU) Basic Concepts 6 Lecture 8 3 / 27

By-Group Processing By-group processing in a procedure step, a BY line identifies each group in SAS output. By-group processing information can be inserted into titles. PROC PRINT, PROC MEANS/PROC SUMMARY and PROC STANDARD, each requires suppressing default BY lines by setting NOBYLINE system option. Set system option BYLINE to resume default by-group processing. wang (WMU) Basic Concepts 6 Lecture 8 3 / 27

By-Group Processing By-group processing in a procedure step, a BY line identifies each group in SAS output. By-group processing information can be inserted into titles. PROC PRINT, PROC MEANS/PROC SUMMARY and PROC STANDARD, each requires suppressing default BY lines by setting NOBYLINE system option. Set system option BYLINE to resume default by-group processing. wang (WMU) Basic Concepts 6 Lecture 8 3 / 27

Inserting By-Line Information TITLEn text-before #BY-spec<.suffix> text-after ; BY-spec is one of 1 BYVALn or BYVAL(By-variable) places value of nth or By-variable by-variable in title. 2 BYVARn or BYVAR(By-variable) places label/name of nth or By-variable by-variable in title. 3 BYLINE places complete default by-line into title. suffix places text immediately following BY-group info. (Note: Period (.), following #BY-spec, works as a delimiter.) See example report1.sas. wang (WMU) Basic Concepts 6 Lecture 8 4 / 27

Inserting By-Line Information TITLEn text-before #BY-spec<.suffix> text-after ; BY-spec is one of 1 BYVALn or BYVAL(By-variable) places value of nth or By-variable by-variable in title. 2 BYVARn or BYVAR(By-variable) places label/name of nth or By-variable by-variable in title. 3 BYLINE places complete default by-line into title. suffix places text immediately following BY-group info. (Note: Period (.), following #BY-spec, works as a delimiter.) See example report1.sas. wang (WMU) Basic Concepts 6 Lecture 8 4 / 27

Inserting By-Line Information TITLEn text-before #BY-spec<.suffix> text-after ; BY-spec is one of 1 BYVALn or BYVAL(By-variable) places value of nth or By-variable by-variable in title. 2 BYVARn or BYVAR(By-variable) places label/name of nth or By-variable by-variable in title. 3 BYLINE places complete default by-line into title. suffix places text immediately following BY-group info. (Note: Period (.), following #BY-spec, works as a delimiter.) See example report1.sas. wang (WMU) Basic Concepts 6 Lecture 8 4 / 27

Outline 1 Use of Byline Information in Title Lines By-Group Processing 2 PROC Report Use of PROC Report PROC REPORT Statement Selected Statements Used in PROC Report 3 PROC Means Comparing PROC Means and PROC Summary Understanding the Use of Variables in PROC Means Available Statistics in PROC Means Creating SAS Data Set with PROC Means 4 PROC Freq The Use of PROC Freq PROC FREQ Statement Statements Used in PROC Freq wang (WMU) Basic Concepts 6 Lecture 8 5 / 27

What PROC Report Does A report writing tool combining features from DATA step PROC Print, PROC Means, and PROC Tabulate which can be used to generate 1 listing reports 2 summary reports wang (WMU) Basic Concepts 6 Lecture 8 6 / 27

What PROC Report Does A report writing tool combining features from DATA step PROC Print, PROC Means, and PROC Tabulate which can be used to generate 1 listing reports 2 summary reports wang (WMU) Basic Concepts 6 Lecture 8 6 / 27

PROC Report Output Under windowing environment, output goes to Report window by default. Can use NOWINDOWS (or NOWD) option in PROC REPORT statement to redirect output to OUTPUT window. wang (WMU) Basic Concepts 6 Lecture 8 7 / 27

PROC Report Output Under windowing environment, output goes to Report window by default. Can use NOWINDOWS (or NOWD) option in PROC REPORT statement to redirect output to OUTPUT window. wang (WMU) Basic Concepts 6 Lecture 8 7 / 27

PROC Report Output Under windowing environment, output goes to Report window by default. Can use NOWINDOWS (or NOWD) option in PROC REPORT statement to redirect output to OUTPUT window. wang (WMU) Basic Concepts 6 Lecture 8 7 / 27

PROC REPORT <option(s)>; Selected options PROC REPORT statement I/O: DATA=, OUT= (output data for further processing) LineSize/PageSize: LS=, PS= NOWD Surrounding box: BOX, FORMCHAR= Centering: CENTER NOCENTER Column spacing: SPACING= Allowing missing value: MISSING Multi-panel report: PANELS=, PSPACE= Column-header appearance: HEADLINE, HEADSKIP, NOHEADER, SPLIT= wang (WMU) Basic Concepts 6 Lecture 8 8 / 27

PROC REPORT <option(s)>; Selected options PROC REPORT statement I/O: DATA=, OUT= (output data for further processing) LineSize/PageSize: LS=, PS= NOWD Surrounding box: BOX, FORMCHAR= Centering: CENTER NOCENTER Column spacing: SPACING= Allowing missing value: MISSING Multi-panel report: PANELS=, PSPACE= Column-header appearance: HEADLINE, HEADSKIP, NOHEADER, SPLIT= wang (WMU) Basic Concepts 6 Lecture 8 8 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

Selected Statements Used in PROC Report COLUMN statement: describes columns and headers DEFINE statement: describes how to use or display a report item COMPUTE statement and ENDCOMP statement: contain programming statement(s) that builds report BREAK statement: produces summary at a break RBREAK statement: produces a default summary at the beginning/end of a report or at the beginning/end of each BY-group LINE statement: valid only in COMPUTE blocks, it provides a subset of PUT statement s features to customize the report BY statement: BY-group processing wang (WMU) Basic Concepts 6 Lecture 8 9 / 27

COLUMN Statement COLUMN column-specification(s); where column-specification is one of the following report-item: identifies an item that forms a column, where report-item is a data set variable, a computed variable, or a statistic report-item-1, report-item-2 <..., report-item-n>: identifies stacked items ( header-1 <... header-n > report-item(s) ): creates one/more headers spanning multiple items (columns) report-item=name: specifies an alias for a report item wang (WMU) Basic Concepts 6 Lecture 8 10 / 27

COLUMN Statement COLUMN column-specification(s); where column-specification is one of the following report-item: identifies an item that forms a column, where report-item is a data set variable, a computed variable, or a statistic report-item-1, report-item-2 <..., report-item-n>: identifies stacked items ( header-1 <... header-n > report-item(s) ): creates one/more headers spanning multiple items (columns) report-item=name: specifies an alias for a report item wang (WMU) Basic Concepts 6 Lecture 8 10 / 27

Available Statistics in PROC Report Descriptive Statistics: MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, STDERR, CV; SUM, SUMWGT, CSS, USS; N, NMISS; PCTN, PCTSUM. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. wang (WMU) Basic Concepts 6 Lecture 8 11 / 27

Available Statistics in PROC Report Descriptive Statistics: MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, STDERR, CV; SUM, SUMWGT, CSS, USS; N, NMISS; PCTN, PCTSUM. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. wang (WMU) Basic Concepts 6 Lecture 8 11 / 27

Available Statistics in PROC Report Descriptive Statistics: MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, STDERR, CV; SUM, SUMWGT, CSS, USS; N, NMISS; PCTN, PCTSUM. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. wang (WMU) Basic Concepts 6 Lecture 8 11 / 27

Available Statistics in PROC Report Descriptive Statistics: MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, STDERR, CV; SUM, SUMWGT, CSS, USS; N, NMISS; PCTN, PCTSUM. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. wang (WMU) Basic Concepts 6 Lecture 8 11 / 27

DEFINE Statement DEFINE report-item / <option(s)>; use of items (specified in option): ANALYSIS (default for data set numeric variables), DISPLAY (default for data set character variables); ORDER; GROUP, ACROSS; COMPUTED. Selected item appearance options: SPACING=, WIDTH=; FORMAT=, ORDER=; MISSING; statistic. Selected report item options: DESCENDING, FLOW, NOPRINT, NOZERO, PAGE. Values/column heading placement: CENTER, LEFT, RIGHT, column-header. wang (WMU) Basic Concepts 6 Lecture 8 12 / 27

DEFINE Statement DEFINE report-item / <option(s)>; use of items (specified in option): ANALYSIS (default for data set numeric variables), DISPLAY (default for data set character variables); ORDER; GROUP, ACROSS; COMPUTED. Selected item appearance options: SPACING=, WIDTH=; FORMAT=, ORDER=; MISSING; statistic. Selected report item options: DESCENDING, FLOW, NOPRINT, NOZERO, PAGE. Values/column heading placement: CENTER, LEFT, RIGHT, column-header. wang (WMU) Basic Concepts 6 Lecture 8 12 / 27

DEFINE Statement DEFINE report-item / <option(s)>; use of items (specified in option): ANALYSIS (default for data set numeric variables), DISPLAY (default for data set character variables); ORDER; GROUP, ACROSS; COMPUTED. Selected item appearance options: SPACING=, WIDTH=; FORMAT=, ORDER=; MISSING; statistic. Selected report item options: DESCENDING, FLOW, NOPRINT, NOZERO, PAGE. Values/column heading placement: CENTER, LEFT, RIGHT, column-header. wang (WMU) Basic Concepts 6 Lecture 8 12 / 27

DEFINE Statement DEFINE report-item / <option(s)>; use of items (specified in option): ANALYSIS (default for data set numeric variables), DISPLAY (default for data set character variables); ORDER; GROUP, ACROSS; COMPUTED. Selected item appearance options: SPACING=, WIDTH=; FORMAT=, ORDER=; MISSING; statistic. Selected report item options: DESCENDING, FLOW, NOPRINT, NOZERO, PAGE. Values/column heading placement: CENTER, LEFT, RIGHT, column-header. wang (WMU) Basic Concepts 6 Lecture 8 12 / 27

DEFINE Statement DEFINE report-item / <option(s)>; use of items (specified in option): ANALYSIS (default for data set numeric variables), DISPLAY (default for data set character variables); ORDER; GROUP, ACROSS; COMPUTED. Selected item appearance options: SPACING=, WIDTH=; FORMAT=, ORDER=; MISSING; statistic. Selected report item options: DESCENDING, FLOW, NOPRINT, NOZERO, PAGE. Values/column heading placement: CENTER, LEFT, RIGHT, column-header. wang (WMU) Basic Concepts 6 Lecture 8 12 / 27

Leading/Ending Characters in Headers Use of one of the following characters as the leading character and as the ending character in a header: repeats itself so the header spans over the multiple items. + * \ _ :. = Use of the pair <> or >< for leading-ending character pair are likewise. See example report1.sas. wang (WMU) Basic Concepts 6 Lecture 8 13 / 27

Outline 1 Use of Byline Information in Title Lines By-Group Processing 2 PROC Report Use of PROC Report PROC REPORT Statement Selected Statements Used in PROC Report 3 PROC Means Comparing PROC Means and PROC Summary Understanding the Use of Variables in PROC Means Available Statistics in PROC Means Creating SAS Data Set with PROC Means 4 PROC Freq The Use of PROC Freq PROC FREQ Statement Statements Used in PROC Freq wang (WMU) Basic Concepts 6 Lecture 8 14 / 27

PROC Means Versus PROC Summary They both produce descriptive statistics over all observations or within groups. They are virtually the same except for default action. PROC Means places output in output window by default while PROC Summary produces output data set by default. wang (WMU) Basic Concepts 6 Lecture 8 15 / 27

PROC Means Versus PROC Summary They both produce descriptive statistics over all observations or within groups. They are virtually the same except for default action. PROC Means places output in output window by default while PROC Summary produces output data set by default. wang (WMU) Basic Concepts 6 Lecture 8 15 / 27

PROC Means Versus PROC Summary They both produce descriptive statistics over all observations or within groups. They are virtually the same except for default action. PROC Means places output in output window by default while PROC Summary produces output data set by default. wang (WMU) Basic Concepts 6 Lecture 8 15 / 27

PROC Means Versus PROC Summary They both produce descriptive statistics over all observations or within groups. They are virtually the same except for default action. PROC Means places output in output window by default while PROC Summary produces output data set by default. wang (WMU) Basic Concepts 6 Lecture 8 15 / 27

Getting Started with PROC Means Two types of variables Analysis variables: numeric variables that you want analyses. Analysis variables are declared in VAR statement. Classification variables: numeric or character variables that you want by-group analyses. Classification variables are declared with a BY statement, or with one or more CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 16 / 27

Getting Started with PROC Means Two types of variables Analysis variables: numeric variables that you want analyses. Analysis variables are declared in VAR statement. Classification variables: numeric or character variables that you want by-group analyses. Classification variables are declared with a BY statement, or with one or more CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 16 / 27

Getting Started with PROC Means Two types of variables Analysis variables: numeric variables that you want analyses. Analysis variables are declared in VAR statement. Classification variables: numeric or character variables that you want by-group analyses. Classification variables are declared with a BY statement, or with one or more CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 16 / 27

Using Classification Variables BY <DESCENDING> variable... <NOTSORTED>; Observations need to be sorted or indexed according to the variables listed in BY statement unless NOTSORTED is requested. CLASS variable(s) </ options>; Observations are not required to be sorted or indexed. Unique combinations of variables levels are computed. Options, if specified, are applied to all variables in the list. Use multiple CLASS statements if you want different options for classification variables. BY statement is preferred for large data set and classification variable with large number of levels. Can use BY statement in combination with CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 17 / 27

Using Classification Variables BY <DESCENDING> variable... <NOTSORTED>; Observations need to be sorted or indexed according to the variables listed in BY statement unless NOTSORTED is requested. CLASS variable(s) </ options>; Observations are not required to be sorted or indexed. Unique combinations of variables levels are computed. Options, if specified, are applied to all variables in the list. Use multiple CLASS statements if you want different options for classification variables. BY statement is preferred for large data set and classification variable with large number of levels. Can use BY statement in combination with CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 17 / 27

Using Classification Variables BY <DESCENDING> variable... <NOTSORTED>; Observations need to be sorted or indexed according to the variables listed in BY statement unless NOTSORTED is requested. CLASS variable(s) </ options>; Observations are not required to be sorted or indexed. Unique combinations of variables levels are computed. Options, if specified, are applied to all variables in the list. Use multiple CLASS statements if you want different options for classification variables. BY statement is preferred for large data set and classification variable with large number of levels. Can use BY statement in combination with CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 17 / 27

Using Classification Variables BY <DESCENDING> variable... <NOTSORTED>; Observations need to be sorted or indexed according to the variables listed in BY statement unless NOTSORTED is requested. CLASS variable(s) </ options>; Observations are not required to be sorted or indexed. Unique combinations of variables levels are computed. Options, if specified, are applied to all variables in the list. Use multiple CLASS statements if you want different options for classification variables. BY statement is preferred for large data set and classification variable with large number of levels. Can use BY statement in combination with CLASS statements. wang (WMU) Basic Concepts 6 Lecture 8 17 / 27

Available Statistics in PROC Means PROC MEANS <option(s)> <statistic(s)>; Descriptive statistics: N, NMISS; MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, SKEWNESS SKEW, KURTOSIS KURT, CV; STDERR, CLM, LCLM, UCLM; SUM, SUMWGT, CSS, USS. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. Default set of statistics: N, MEAN, STD, MIN, and MAX. wang (WMU) Basic Concepts 6 Lecture 8 18 / 27

Available Statistics in PROC Means PROC MEANS <option(s)> <statistic(s)>; Descriptive statistics: N, NMISS; MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, SKEWNESS SKEW, KURTOSIS KURT, CV; STDERR, CLM, LCLM, UCLM; SUM, SUMWGT, CSS, USS. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. Default set of statistics: N, MEAN, STD, MIN, and MAX. wang (WMU) Basic Concepts 6 Lecture 8 18 / 27

Available Statistics in PROC Means PROC MEANS <option(s)> <statistic(s)>; Descriptive statistics: N, NMISS; MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, SKEWNESS SKEW, KURTOSIS KURT, CV; STDERR, CLM, LCLM, UCLM; SUM, SUMWGT, CSS, USS. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. Default set of statistics: N, MEAN, STD, MIN, and MAX. wang (WMU) Basic Concepts 6 Lecture 8 18 / 27

Available Statistics in PROC Means PROC MEANS <option(s)> <statistic(s)>; Descriptive statistics: N, NMISS; MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, SKEWNESS SKEW, KURTOSIS KURT, CV; STDERR, CLM, LCLM, UCLM; SUM, SUMWGT, CSS, USS. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. Default set of statistics: N, MEAN, STD, MIN, and MAX. wang (WMU) Basic Concepts 6 Lecture 8 18 / 27

Available Statistics in PROC Means PROC MEANS <option(s)> <statistic(s)>; Descriptive statistics: N, NMISS; MIN, MAX, RANGE; MEAN, VAR, STDDEV STD, SKEWNESS SKEW, KURTOSIS KURT, CV; STDERR, CLM, LCLM, UCLM; SUM, SUMWGT, CSS, USS. Quantiles: P1, P5, P10, Q1 P25, MEDIAN P50, Q3 P75, P90, P95, and P99; QRANGE. Test Statistics: T and PROBT. Default set of statistics: N, MEAN, STD, MIN, and MAX. wang (WMU) Basic Concepts 6 Lecture 8 18 / 27

Creating SAS Data Set with PROC Means Use OUTPUT statements to create SAS data sets. Within same OUTPUT statement, need to specify what statistics needed. Can request different statistics for different variables listed in VAR statement. In an OUTPUT statement, it s good practice to name output data set variables or use AUTONAME option. wang (WMU) Basic Concepts 6 Lecture 8 19 / 27

Creating SAS Data Set with PROC Means Use OUTPUT statements to create SAS data sets. Within same OUTPUT statement, need to specify what statistics needed. Can request different statistics for different variables listed in VAR statement. In an OUTPUT statement, it s good practice to name output data set variables or use AUTONAME option. wang (WMU) Basic Concepts 6 Lecture 8 19 / 27

Creating SAS Data Set with PROC Means Use OUTPUT statements to create SAS data sets. Within same OUTPUT statement, need to specify what statistics needed. Can request different statistics for different variables listed in VAR statement. In an OUTPUT statement, it s good practice to name output data set variables or use AUTONAME option. wang (WMU) Basic Concepts 6 Lecture 8 19 / 27

Creating SAS Data Set with PROC Means Use OUTPUT statements to create SAS data sets. Within same OUTPUT statement, need to specify what statistics needed. Can request different statistics for different variables listed in VAR statement. In an OUTPUT statement, it s good practice to name output data set variables or use AUTONAME option. wang (WMU) Basic Concepts 6 Lecture 8 19 / 27

Creating SAS Data Set with PROC Means Use OUTPUT statements to create SAS data sets. Within same OUTPUT statement, need to specify what statistics needed. Can request different statistics for different variables listed in VAR statement. In an OUTPUT statement, it s good practice to name output data set variables or use AUTONAME option. wang (WMU) Basic Concepts 6 Lecture 8 19 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

_TYPE_ & _FREQ_ Automatic Variables in Output Data Set _TYPE_ contains information about class variables 1 _TYPE_ is numeric by default if 32 or less classification variables are specified, and character otherwise. 2 if CHARTYPE option is specified in PROC MEANS statement then _TYPE_ is character. 3 the character value of _TYPE_ is the binary representation of the numeric values. For instances, if three classification variables are specified in this order: A then B then C, then 011 (value of 3) is the subgroup represented by B*C; 101 (value of 5) is for A*C; 100 (value of 4) is for A; etc. _FREQ_ contains the number of observations that a given output level represents. wang (WMU) Basic Concepts 6 Lecture 8 20 / 27

WAYS and TYPES Statements Both statements are used to select a subsets of class combinations. TYPES request(s); For instances, TYPES (A B)*C;, TYPES (A B)*(C D);, TYPES ();. WAYS list; For instances, WAYS 0 TO 2;, WAYS 1,3;. Output data are arranged in ascending order of _TYPE_ unless otherwise DESCENDTYPES option is specified in PROC MEANS statement. wang (WMU) Basic Concepts 6 Lecture 8 21 / 27

WAYS and TYPES Statements Both statements are used to select a subsets of class combinations. TYPES request(s); For instances, TYPES (A B)*C;, TYPES (A B)*(C D);, TYPES ();. WAYS list; For instances, WAYS 0 TO 2;, WAYS 1,3;. Output data are arranged in ascending order of _TYPE_ unless otherwise DESCENDTYPES option is specified in PROC MEANS statement. wang (WMU) Basic Concepts 6 Lecture 8 21 / 27

WAYS and TYPES Statements Both statements are used to select a subsets of class combinations. TYPES request(s); For instances, TYPES (A B)*C;, TYPES (A B)*(C D);, TYPES ();. WAYS list; For instances, WAYS 0 TO 2;, WAYS 1,3;. Output data are arranged in ascending order of _TYPE_ unless otherwise DESCENDTYPES option is specified in PROC MEANS statement. wang (WMU) Basic Concepts 6 Lecture 8 21 / 27

WAYS and TYPES Statements Both statements are used to select a subsets of class combinations. TYPES request(s); For instances, TYPES (A B)*C;, TYPES (A B)*(C D);, TYPES ();. WAYS list; For instances, WAYS 0 TO 2;, WAYS 1,3;. Output data are arranged in ascending order of _TYPE_ unless otherwise DESCENDTYPES option is specified in PROC MEANS statement. wang (WMU) Basic Concepts 6 Lecture 8 21 / 27

WAYS and TYPES Statements Both statements are used to select a subsets of class combinations. TYPES request(s); For instances, TYPES (A B)*C;, TYPES (A B)*(C D);, TYPES ();. WAYS list; For instances, WAYS 0 TO 2;, WAYS 1,3;. Output data are arranged in ascending order of _TYPE_ unless otherwise DESCENDTYPES option is specified in PROC MEANS statement. wang (WMU) Basic Concepts 6 Lecture 8 21 / 27

Outline 1 Use of Byline Information in Title Lines By-Group Processing 2 PROC Report Use of PROC Report PROC REPORT Statement Selected Statements Used in PROC Report 3 PROC Means Comparing PROC Means and PROC Summary Understanding the Use of Variables in PROC Means Available Statistics in PROC Means Creating SAS Data Set with PROC Means 4 PROC Freq The Use of PROC Freq PROC FREQ Statement Statements Used in PROC Freq wang (WMU) Basic Concepts 6 Lecture 8 22 / 27

What PROC Freq Does Produce one-way frequency tables, by default, of all variables. Statistics can be computed to test for equal proportions, specified proportions, or the binomial proportion. Can produce multi-way frequency and crosstabulation (contingency) tables. Statistics can be computed for the examination of the relationships between two classification variables adjusting for any stratification variables. wang (WMU) Basic Concepts 6 Lecture 8 23 / 27

What PROC Freq Does Produce one-way frequency tables, by default, of all variables. Statistics can be computed to test for equal proportions, specified proportions, or the binomial proportion. Can produce multi-way frequency and crosstabulation (contingency) tables. Statistics can be computed for the examination of the relationships between two classification variables adjusting for any stratification variables. wang (WMU) Basic Concepts 6 Lecture 8 23 / 27

What PROC Freq Does Produce one-way frequency tables, by default, of all variables. Statistics can be computed to test for equal proportions, specified proportions, or the binomial proportion. Can produce multi-way frequency and crosstabulation (contingency) tables. Statistics can be computed for the examination of the relationships between two classification variables adjusting for any stratification variables. wang (WMU) Basic Concepts 6 Lecture 8 23 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

PROC FREQ Statement PROC FREQ <options>; Options include DATA=: specifies the input data set. COMPRESS: begins next one-way table on current page. FORMCHAR=: specifies outline and cell divider characters in crosstabulation table. NLEVELS: displays the number of levels for all TABLES variables. NOPRINT: suppresses all displayed output. ORDER=: specifies the order for listing variable values. PAGE: displays one table per page. wang (WMU) Basic Concepts 6 Lecture 8 24 / 27

Statements Used in PROC Freq BY statement: By-group processing. TABLES statement: requests tables and statistics. TEST statement: requests asymptotic tests for the specified measures of association and measures of agreement. EXACT statement: requests exact tests or confidence limits for the specified statistics. OUTPUT statement: creates a SAS data set containing statistics computed by PROC Freq. WEIGHT statement: specifies a numeric variable with a value that represents the frequency of the observation. wang (WMU) Basic Concepts 6 Lecture 8 25 / 27

Statements Used in PROC Freq BY statement: By-group processing. TABLES statement: requests tables and statistics. TEST statement: requests asymptotic tests for the specified measures of association and measures of agreement. EXACT statement: requests exact tests or confidence limits for the specified statistics. OUTPUT statement: creates a SAS data set containing statistics computed by PROC Freq. WEIGHT statement: specifies a numeric variable with a value that represents the frequency of the observation. wang (WMU) Basic Concepts 6 Lecture 8 25 / 27

TABLES Statement TABLES requests < / options >; where requests are in the form variable by itself requests one-way table variable-1*variable-2*... variable-n requests n-way table; the last two variables in the request constitute row and column while others define strata. Can use parentheses for grouping. For instances, TABLES A*(B C);, and TABLES (A B)*(C D);. Can use variable-list shortcuts. For instance, TABLES A * (B-D) * (E1-E3);. wang (WMU) Basic Concepts 6 Lecture 8 26 / 27

TABLES Statement TABLES requests < / options >; where requests are in the form variable by itself requests one-way table variable-1*variable-2*... variable-n requests n-way table; the last two variables in the request constitute row and column while others define strata. Can use parentheses for grouping. For instances, TABLES A*(B C);, and TABLES (A B)*(C D);. Can use variable-list shortcuts. For instance, TABLES A * (B-D) * (E1-E3);. wang (WMU) Basic Concepts 6 Lecture 8 26 / 27

TABLES Statement TABLES requests < / options >; where requests are in the form variable by itself requests one-way table variable-1*variable-2*... variable-n requests n-way table; the last two variables in the request constitute row and column while others define strata. Can use parentheses for grouping. For instances, TABLES A*(B C);, and TABLES (A B)*(C D);. Can use variable-list shortcuts. For instance, TABLES A * (B-D) * (E1-E3);. wang (WMU) Basic Concepts 6 Lecture 8 26 / 27

TABLES Statement TABLES requests < / options >; where requests are in the form variable by itself requests one-way table variable-1*variable-2*... variable-n requests n-way table; the last two variables in the request constitute row and column while others define strata. Can use parentheses for grouping. For instances, TABLES A*(B C);, and TABLES (A B)*(C D);. Can use variable-list shortcuts. For instance, TABLES A * (B-D) * (E1-E3);. wang (WMU) Basic Concepts 6 Lecture 8 26 / 27

TABLES Statement TABLES requests < / options >; where requests are in the form variable by itself requests one-way table variable-1*variable-2*... variable-n requests n-way table; the last two variables in the request constitute row and column while others define strata. Can use parentheses for grouping. For instances, TABLES A*(B C);, and TABLES (A B)*(C D);. Can use variable-list shortcuts. For instance, TABLES A * (B-D) * (E1-E3);. wang (WMU) Basic Concepts 6 Lecture 8 26 / 27

OUTPUT Statement OUTPUT <OUT= SAS-data-set> options ; Only one OUTPUT statement is allowed. A TABLES statement is required to go with the OUTPUT statement. If multiple TABLES statements are specified, the contents of the OUTPUT data set correspond to the last TABLES statement. If multiple tables are requested in a TABLES statement, the contents of the OUTPUT data set correspond to the last table request. wang (WMU) Basic Concepts 6 Lecture 8 27 / 27

OUTPUT Statement OUTPUT <OUT= SAS-data-set> options ; Only one OUTPUT statement is allowed. A TABLES statement is required to go with the OUTPUT statement. If multiple TABLES statements are specified, the contents of the OUTPUT data set correspond to the last TABLES statement. If multiple tables are requested in a TABLES statement, the contents of the OUTPUT data set correspond to the last table request. wang (WMU) Basic Concepts 6 Lecture 8 27 / 27