The Power of Proc Tabulate Part 1: The Basics David M. Rivard.

Slides:



Advertisements
Similar presentations
Introduction to Data Set Options Mark Tabladillo, Ph.D. Software Developer, MarkTab Consulting Associate Faculty, University of Phoenix January 30, 2007.
Advertisements

Haas MFE SAS Workshop Lecture 3:
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Technology Short Courses: Spring 2010 Kentaka Aruga
The SAS ® System Additional Information on Statistical Analysis Programming.
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Knowing Understanding the Basics Writing your own code part 2 SAS Lab.
I OWA S TATE U NIVERSITY Department of Animal Science Modifying and Combing SAS Data Sets (Chapter in the 6 Little SAS Book) Animal Science 500 Lecture.
Microsoft Excel Working with Excel Lists, Subtotals and Pivot Tables.
Excel Graphing Tutorial Lauren Ottaviano Fall 2012.
Quick Data Summaries in SAS Start by bringing in data –Use permanent data set for these examples Proc Tabulate –Produces summaries very quickly and easily.
15b. Accessing Data: Frequencies in SAS ®. 1 Prerequisites Recommended modules to complete before viewing this module  1. Introduction to the NLTS2 Training.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
Data Preparation for Analytics Using SAS Gerhard Svolba, Ph.D. Reviewed by Madera Ebby, Ph.D.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
A Concise Display of Multiple Response Items Patrick Thornton.
SAS PROC REPORT PROC TABULATE
Chapter 9 Producing Descriptive Statistics PROC MEANS; Summarize descriptive statistics for continuous numeric variables. PROC FREQ; Summarize frequency.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Data Analysis Using SPSS
PROC REPORT organizes the output in many ways, from the simple to highly complex… PROC REPORT NOWINDOWS HEADLINE HEADSKIP; COLUMN variable-list; DEFINE.
October 2003Bent Thomsen - FIT 3-21 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
1 Data List Spreadsheets or simple databases - a different use of Spreadsheets Bent Thomsen.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
A Brief Introduction to PROC TRANSPOSE prepared by Voytek Grus for
Knowing Understanding the Basics Writing your own code SAS Lab.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
What is SPSS  SPSS is a program software used for statistical analysis.  Statistical Package for Social Sciences.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
SAS ODS (Output Delivery System) Donald Miller 812 Oswald Tower ;
XP. Objectives Sort data and filter data Summarize an Excel table Insert subtotals into a range of data Outline buttons to show or hide details Create.
Chapter 22: Using Best Practices 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
Lecture 3 Topic - Descriptive Procedures Programs 3-4 LSB 4:1-4.4; 4:9:4:11; 8:1-8:5; 5:1-5.2.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
1 EPIB 698C Lecture 4 Raul Cruz-Cano Summer 2012.
An Introduction Katherine Nicholas & Liqiong Fan.
SW388R6 Data Analysis and Computers I Slide 1 Comparing Central Tendency and Variability across Groups Impact of Missing Data on Group Comparisons Sample.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.
Data Management Research Methods Professional Development Institute December 4, 2015.
BMTRY 789 Lecture9: Proc Tabulate Readings – Chapter 11 & Selected SUGI Reading Lab Problems , 11.2 Homework Due Next Week– HW6.
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Four way analysis Nursing home residence Gender Age Death.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Creating summary tables using the sumtable command
Applied Business Forecasting and Regression Analysis
Lesson 8 - Topics Creating SAS datasets from procedures
Chapter 4: Sorting, Printing, Summarizing
Quick Data Summaries in SAS
Producing Descriptive Statistics
Introduction to SAS Essentials Mastering SAS for Data Analytics
Bent Thomsen Institut for Datalogi Aalborg Universitet
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

The Power of Proc Tabulate Part 1: The Basics David M. Rivard

Introduction Provides the capability to produce customized professional tables for usage in presentations and reports Syntax based on the Table Producing Language developed by the U.S. Department of Labor Reports summary statistics which are available in Freq, Means, and Summary procedures Handles multiple variables in rows and columns and multiple levels within the rows and columns

Series Presentation Outline Proc Tabulate will be presented as a series because the syntax for the procedure may appear complex and intimidating Part 1 Examples of tables produced by the Tabulate and Means procedures Suggested basic steps to begin developing a table General coding format Creating and customizing a simple table

Dataset Attributes 428 Records NAME: 2004 New Car and Truck Data TYPE: Sample SIZE: 428 observations, 19 variables DESCRIPTIVE ABSTRACT: Specifications are given for 428 new vehicles for the 2004 year. The variables recorded include price, measurements relating to the size of the vehicle, and fuel efficiency. SOURCE: _Kiplinger's Personal Finance_, December 2003, vol. 57, no. 12, pp ,

Examples of Proc Means proc means data = sasuser.cars; by type; var cyl mpg_city mpg_hwy weight length; run; proc means data = sasuser.cars; class type; var cyl mpg_city mpg_hwy weight length; run;

proc means data = sasuser.cars mean; class type doors; by cyl; var mpg_city mpg_hwy weight length; run;

proc means data = sasuser.cars mean; class type doors cyl; var mpg_city mpg_hwy weight length; run; What else can I do? Data set had to be resorted by new variables every time a change was made

Example of Proc Tabulate By making simple code changes you can slice and dice your table just as you would an EXCEL pivot table. The best part is that SAS does it for you in one procedure verses exporting data to EXCEL and creating the pivot table And how the data is sorted does not matter!

How to Begin Determine what statistics to present Sketch a draft of the report Generate the basic code Test, retest, and verify the results using a subset of the data Continue developing the code and creating the table in stages Run the program on the complete data Clean up the final appearance of the table Include ODS Functionality (discussed in the last series)

General Coding Format PROC TABULATE Data = mydata ; CLASS variables; TABLE page dimension, row dimension, column dimension / RUN;

Basic Syntax Rules CLASS: categories (numeric or character) VAR: used in the analysis (numeric) TABLE: constructs the appearance The tables page, row, and column dimensions are separated by commas The asterisk (*) is an operator and specifies: Add another CLASS variable split Include another variable Add a statistic to a variable Designate a format

Let Us Begin Cylinders MPG CityMPG HWY Domestic2dr 4dr All Import2dr 4dr All

proc tabulate data = sasuser.cars; class type; var mpg_city mpg_hwy; table type, (mpg_city mpg_hwy)*mean; run; proc tabulate data = sasuser.cars; class type; var mpg_city mpg_hwy; table (mpg_city mpg_hwy)*mean; run; proc tabulate data = sasuser.cars; class type cyl; var mpg_city mpg_hwy; table type, (mpg_city mpg_hwy) *cyl *mean; run;

proc tabulate data = sasuser.cars; class type cyl; var mpg_city mpg_hwy; table type * cyl, (mpg_city mpg_hwy)*mean; run; proc tabulate data = sasuser.cars; class type cyl; var mpg_city mpg_hwy; table type*cyl, (mpg_city mpg_hwy)*mean n='type'; run;

proc tabulate data = sasuser.cars; class type cyl; var mpg_city mpg_hwy; table type*(cyl all), (mpg_city mpg_hwy)*mean; run; proc tabulate data = sasuser.cars; class type cyl; var mpg_city mpg_hwy; table (type all)*(cyl all), (mpg_city mpg_hwy)*mean ; run; Proc Tabulate provides flexibility

Remember Our Original Table? Cylinders MPG CityMPG HWY Domestic2dr 4dr All Import2dr 4dr All

proc tabulate data = sasuser.cars; class type doors cyl; var mpg_city mpg_hwy; table type*(doors all), cyl*(mpg_city mpg_hwy)*mean ; run;

proc tabulate data = sasuser.cars; class type doors cyl; var mpg_city mpg_hwy; table type='Manufacturer'*(doors='Body Style' all='Overall'), cyl*(mpg_city='City' mpg_hwy='Hwy')*mean=' ' / BOX = 'MPG Analysis'; run; This is okay but let us make it better I should have written Average MPG Analysis

Now we have a table worth presenting proc tabulate data = sasuser.cars; class type doors cyl; var mpg_city mpg_hwy; table type=' '*(doors=' ' all='Overall'), cyl= ' Engine Cylinders'*(mpg_city='City' mpg_hwy='Hwy')*mean=' ' / BOX = 'MPG Analysis'; run;

The Missing Option The data contains variables with missing values Our MPG results would be incorrect if we included on these variables WHY? If an observation contains missing values for any of the variables then that observation is ignored (This was not the case with our sample table since no missing values occurred in the chosen variables) Using the Missing option in the proc statement will tell SAS to include all observations regardless of missing values

What to Expect Next We have only scratched the surface with PROC TABULATE In the next presentation we will add the following: Formats Percents and percent of sums Other statistics such as min, max, standard deviation, and so on ODS (Output Delivery System) function for stylized tables Inserting logos and pictures

A Bonus for Attending Data guess; do row = 0.0 to 3.4 by 0.1; do column = 0.00 to 0.09 by 0.01; z = row + column; prob = probnorm(z); output; end; run; Proc Tabulate data = guess; class row column; var prob; table row, column*prob=''*sum=''*f=5.4/rtspace=5; label row = 'Z' column = Guess What This Does'; run; Can you guess what the code does?

What does this code do? data quess; do df=1 to 30 by 1; do prob=0.80, 0.85, 0.90, 0.925, 0.975, 0.99; t=TINV(prob, df); output; end; run; Proc tabulate data = quess; class df prob; var t; table df, prob*t=''*mean=''*f=7.4/rtspace=7 box = 'T'; Label prob = 'Probability'; run;

Resources Park, Hun Myoung Joint Ph.D. student in Public Policy in the Department of Political Science and the School of Public and Environmental Affairs Indiana University. SAS Tabulate Pass,Ray and Sandy McNeill. Proc Tabulate: Doin It I Style Hawworth, Lauren. Anyone Can Learn PROC TABULATE, v pdfhttp://www2.sas.com/proceedings/sugi27/p pdf Why Use Proc Tabulate. Johnson, Roger W. NAME: 2004 New Car and Truck Data Department of Mathematics and Computer Science South Dakota School of Mines and Technology Jonas V. Bilenas, Making Sense of PROC TABULATE JP Morgan Chase, Wilmington, DE

Thank you for attending and happy proc tabulating