A Concise Display of Multiple Response Items Patrick Thornton.

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

When Good Looks Arent Enough Lisa Eckler. When Good Looks Arent Enough.
The Power of Proc Tabulate Part 1: The Basics David M. Rivard.
©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc.
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Knowing Understanding the Basics Writing your own code part 2 SAS Lab.
SAS Programming: Working With Variables. Data Step Manipulations New variables should be created during a Data step Existing variables should be manipulated.
Increase Pattern Detection in SAS® GTL with New Categorical Histograms and Color Coded Asymmetric Violin Plots Perry Watts, Stakana Analytics,
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.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
Basic And Advanced SAS Programming
Jeremy W. Poling B&W Y-12 L.L.C. Can’t Decide Whether to Use a DATA Step or PROC SQL? You Can Have It Both Ways with the SQL Function!
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
FORMAT FESTIVAL AN INTRODUCTION TO SAS® FORMATS AND INFORMATS By David Maddox.
Statistical Discovery. TM From SAS. JMP ® Software: Introduction to Categorical Data Analysis.
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
Chapter 10:Processing Macro Variables at Execution Time 1 STAT 541 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
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.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Chapter 1: Introduction 1.1 Course Logistics 1.2 Purpose of the Macro Facility 1.3 Program Flow.
Copyright © 2008, SAS Institute Inc. All rights reserved. RMS Titanic: Using SAS Enterprise Guide To Report On A Tragedy Matt Malczewski, SAS Canada.
Niraj J. Pandya, Element Technologies Inc., NJ.  Summarize all possible combinations of class level variables even if few categories are altogether missing.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
%rtf2data: A utility macro to convert RTF Table to SAS® dataset
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
SAS 介绍和举例 Presented by 经济实验教学中心 商务数据挖掘中心. Raw Data Read in Data Process Data (Create new variables) Output Data (Create SAS Dataset) Analyze Data Using.
PROC SQL: Tips and Translations for Data Step Users By: Gail Jorgensen Susan Marcella.
Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Essential ODS PDF Patrick Thornton.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
1 Filling in the blanks with PROC FREQ Bill Klein Ryerson University.
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.
© OCS Biometric Support 1 APPEND, EXECUTE and MACRO Jim Groeneveld, OCS Biometric Support, ‘s Hertogenbosch, Netherlands. PhUSE 2010 – CC05 PhUSE 2010.
Creating and Using Custom Formats for Data Manipulation and Summarization Presented by John Schmitz, Ph.D. Schmitz Analytic Solutions, LLC Certified Advanced.
Chapter 17: Formatting Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Copyright © 2005, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Copyright © 2010, SAS Institute Inc. All rights reserved. SAS ® Using the SAS Grid.
Lesson 8 - Topics Creating SAS datasets from procedures Using ODS and data steps to make reports Using PROC RANK Programs in course notes LSB 4:11;5:3.
Rob Gately OptumInsight, Epidemiology Waltham, MA Adjusting Analyses of Survey Results using a Predicted Probability of Response Presented at DSUG Colorado.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall2(1)-1 Chapter 2: Displaying and Summarizing Data Part 1: Displaying Data With Charts.
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.
Chapter 17 Supplement: Alternatives to IF-THEN/ELSE Processing STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South.
Second Period: PROC TABULATE Jill Casey. Example 1: Simple 2D Table.
Patrick Thornton SRI International.  Example of a Multiple Response Item ◦ Variable coding and example data  A Cross Tabulation using Proc REPORT 
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
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.
Applied Business Forecasting and Regression Analysis
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
A brief introduction to the topic
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
PROC DOC III: Self-generating Codebooks Using SAS®
Quick Data Summaries in SAS
%SUBMIT R A SAS® Macro to Interface SAS and R
Architecture + system-based How to assign passwords
Automate Repetitive Programming Tasks: Effective SAS® Code Generators
Presentation transcript:

A Concise Display of Multiple Response Items Patrick Thornton

Multiple Response Items: Outline  Example item, response & indicator variables  Summarize responses using indicator variables and a PROC FREQ  Summarizing responses into a single table –Create binary variable from indicators variables –Create a decimal variable from the binary –Create a MULTILABEL format for the decimal –Summarize responses in PROC TABULATE  Conclusion

Multiple Response Item with Example Responses  Are you proficient at speaking the following languages (answer all that apply)? –Spanish (yes) –English (yes) –Chinese (no)

Language Indicator Variables to Store the Responses data mydata; length e1-e3 gender 8.; label e1 = 'Spanish' e2='English' e3='Chinese' gender='Gender'; input e1 e2 e3 gender; cards; ;run;

Formatting Language Indicator Variables proc format; value yesno 1 = 'Yes' 0 = 'No'; value gender 1 ='Male' 2 = 'Female'; run; data mydata; set mydata; format e1-e3 yesno. gender gender.; run;

Using PROC FREQ and the Indicator Variables to Display Language Responses TITLE1 “Standard Reporting Generates a Table for Each Variable”; PROC FREQ data=mydata; TABLE e1-e3; run;

Using PROC FREQ and the Indicator Variables to Display Language Responses

Using PROC TABULATE to Display the Language Responses

Creating Binary Variable from the Indicator Variables data mydata; set mydata; length language_binary $3.; language_binary = strip(catt(of e3 e2 e1)); run;

List Indicator and Binary Variables

Create a MULTILABEL Format based on 3 Character Binary Variable Proc format; value $langf (multilabel notsorted ) '000' = 'Missing' '001','011','101','111' = 'Spanish' '010','011','110','111'= 'English' '100','101','110','111'='Chinese'; run;

List Indicator and Binary Variables

Create a MULTILABEL Format based on 2 Character Binary Variable Proc format; value $langf (multilabel notsorted) '00' = 'Missing' '01','11' = 'Spanish' '10','11', = 'English'; Run;

Creating Binary and Decimal Variables from the Indicator Variables data mydata; set mydata; length language_binary $3. language_profile 8.; language_binary = strip(catt(of e3 e2 e1)); language_profile=input(language_binary,binary3.); run;

Listing of Binary and Decimal Variables

MULTILABEL Format to Label Decimal Values Proc format; value langf (multilabel notsorted ) 0 = 'Missing' 1,3,5,7 = 'Spanish' 2,3,6,7= 'English' 4,5,6,7= 'Chinese'; Run;

PROC TABULATE, MULTILABEL, and Decimal Variable proc tabulate data=mydata ; class language_profile /ORDER=DATA PRELOADFMT MLF; table language_profile="Language" all='Total', (n* format=10.0 pctn='%'*format=7.1)/ box='Table 1 Student reported language proficiency' rtspace=20; format language_profile $langf. ; run;

Single Table Display of Multiple Response Language Item

PROC TABULATE, MULTILABEL, Decimal Variable, and Column Variable proc tabulate data=mydata ; class language_profile /ORDER=DATA PRELOADFMT MLF; class gender; table language_profile="Language" all='Total', gender* (n* format=10.0 pctn='%'*format=7.1)/ box='Table 2 Student reported language proficiency by gender' rtspace=20; format language_profile $langf. ; run;

Single Table Display of Multiple Response Language Item and Gender

Macro Program for Creating the Multi-Label Format Thornton, P. (2013). A Concise Display of Multiple Response Items. Proceedings of the 2013 SAS Global Forum, San Francisco, CA

Bonus: BAND Function – Is it useful?  BAND is a function that performs a bitwise AND operation on two arguments –The result is a multiplication of each position in the binary form of two numbers –x=BAND (arg1,arg2) Arg1 = 001 Arg2 = 001 X = 1 –By passing 001 as Arg2, I can confirm a 1 is in the same position in Arg1

Is it useful to subset OBS with BAND? proc print data=mydata label; var language_binary language_profile e3-e1; where e1 = 1; run; proc print data=mydata label; var language_binary language_profile e3-e1; where band(language_profile,001); run;

Test of the BAND Function

Test of the BAND Function (con’t)

It does seem possible to subset OBS based on BAND proc print data=example label; var language_binary language_profile e6-e1; where band(language_profile,101010); run; Data subset; set example; if band(language_profile,101010); Run;

Conclusion  Creating binary and decimal variables from a series of indicator variables is useful –Display responses with PROC TABULATE and MULTILABEL format –A macro program can be used to build the format  Limitation –Observations where missing responses cannot be considered a “no” response must be removed from the display –Maximum of about 10 indicators (ie. 2**10-1 combinations)

SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or Trademarks of their respective companies. The Power To Know ™ SAS ®

Contact Information Patrick Thornton, Ph.D. 333 Ravenswood Ave Menlo Park, CA