A Brief Introduction to PROC TRANSPOSE prepared by Voytek Grus for

Slides:



Advertisements
Similar presentations
Copyright © 2006, SAS Institute Inc. All rights reserved. Think FAST! Use Memory Tables (Hashing) for Faster Merging Gregg P. Snell Data Savant Consulting.
Advertisements

Introduction to SAS. What is a data set? A data set (or dataset) is a collection of data, usually presented in tabular form. Each column represents a.
How SAS implements structured programming constructs
Slide C.1 SAS MathematicalMarketing Appendix C: SAS Software Uses of SAS  CRM  datamining  data warehousing  linear programming  forecasting  econometrics.
16b. Accessing Data: Means in SAS ®. 1 Prerequisites Recommended modules to complete before viewing this module  1. Introduction to the NLTS2 Training.
A guide to the unknown…  A dataset is longitudinal if it tracks the same type of information on the same subjects at multiple points in time or space.
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.
I OWA S TATE U NIVERSITY Department of Animal Science Getting Started Using SAS Software Animal Science 500 Lecture No. 2.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
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.
SAS PROCs ISYS 650. PROC Statement Syntax PROC name options; Statements statement options; … RUN;
Basic And Advanced SAS Programming
SAS Programming SAS Data Mart. Outline Access different format of data for SAS SAS data mart SAS data manipulation 2.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
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.
SAS SQL SAS Seminar Series
SAS PROC REPORT PROC TABULATE
Lecture 5 Sorting, Printing, and Summarizing Your Data.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
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 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
Niraj J. Pandya, Element Technologies Inc., NJ.  Summarize all possible combinations of class level variables even if few categories are altogether missing.
18b. PROC SURVEY Procedures in SAS ®. 1 Prerequisites Recommended modules to complete before viewing this module  1. Introduction to the NLTS2 Training.
Key Data Management Tasks in Stata
PREPARING DATA FOR STATISTICAL ANALYSIS Data Cleaning Data Cleaning Dataset Preparation Dataset Preparation Documentation Documentation 9 September 2008.
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview.
Application of SAS Software at NSPI presented by Voytek Grus Pricing Specialist, Marketing Dept. for SAS user group, Halifax March 11, 2005.
Knowing Understanding the Basics Writing your own code SAS Lab.
Parallel Processing in SAS CPUCOUNT A comparison of Proc Means for the Project.
1 SAS 1-liners SAS Coding Efficiencies. 2 Overview Less is more Always aim for robust, reusable and efficient code Coding efficiency versus processing.
Grant Brown.  AIDS patients – compliance with treatment  Binary response – complied or no  Attempt to find factors associated with better compliance.
Using Weighted Data Donald Miller Population Research Institute 812 Oswald Tower, December 2008.
Regression in SAS Caitlin Phelps. Importing Data  Proc Import:  Read in variables in data set  May need some options incase SAS doesn’t guess the format.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
The Power of the BY Statement SVSUG Paul Choate, California Developmental Services (& Toby Dunn, U.S. Army Medical Department Center & School)
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
Analysis Introduction Data files, SPSS, and Survey Statistics.
1 Statistical Software Programming. STAT 6360 –Statistical Software Programming Modifying and Combining Datasets For most tasks we need to work with multiple.
Time Series Data Processes by Tai Yu April 15, 2013.
An Introduction Katherine Nicholas & Liqiong Fan.
Efficient SAS programming with Large Data Aidan McDermott Computing Group, March 2007.
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.
An Introduction to Proc Transpose David P. Rosenfeld HR Consultant, Workforce Planning & Data Management City of Toronto.
Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.
Multiple Imputation using SAS Don Miller 812 Oswald Tower
BMTRY 789 Lecture 6: Proc Sort, Random Number Generators, and Do Loops Readings – Chapters 5 & 6 Lab Problem - Brain Teaser Homework Due – HW 2 Homework.
LISA SHORT COURSE SERIES: INTRODUCTION TO SAS UNIVERSITY William DeShong Fall 2015.
SHRUG, F EB 2013: N ETWORKING EXERCISE Many Ways to Solve a SAS Problem.
Chapter 6: Modifying and Combining Data Sets  The SET statement is a powerful statement in the DATA step DATA newdatasetname; SET olddatasetname;.. run;
Aggregator Stage : Definition : Aggregator classifies data rows from a single input link into groups and calculates totals or other aggregate functions.
Real Time Remote Access Comparing SAS and SPSS David Price Quy Do April 2013.
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
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 Chapter 26 By Tasha Chapman, Oregon Health Authority.
 CONACT UC:  Magnific training   
The Urban Institute - SAS Training6/9/20161 SAS Training This SAS Training Course was designed to introduce users at The Urban Institute to SAS programming.
Determination of efficient pricing periods using SAS prepared by Voytek Grus for SAS user group, Halifax April 30, 2010.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Working Efficiently with Large SAS® Datasets Vishal Jain Senior Programmer.
IFS180 Intro. to Data Management Chapter 10 - Unions.
Applied Business Forecasting and Regression Analysis
Chapter 6: Modifying and Combining Data Sets
Quick Data Summaries in SAS
Introduction to DATA Step Programming: SAS Basics II
Use of PROC TABULATE Out File to Customize Tables
Presentation transcript:

A Brief Introduction to PROC TRANSPOSE prepared by Voytek Grus for SAS user group, Halifax November 26, 2009

What is data transposition? Matrix notation: : XT Excel: copy/paste/transpose command or pivot tables. Example of a simple data transposition:

Examples of Complex data transpositions Full Transp. Interleaved Dataset

Why do we transpose data? For data presentation purposes. To merge datasets with diverse structures To re-design databases efficiency gains in programming code and processing time.

Transposing data to streamline SAS calc. and programming code. Cross-sectional data base design Sequential data base design Data Step Array def. Do loop If condition Then output; Run; Proc Transpose This db design is more amenable to sequential data processing using SAS procs with BY statements Proc means, proc regression, proc univariate etc.. Data Step type of processing Data test2; Set test1; Sum= var1+ var2+var3;run;

Syntax of Proc Transpose PROC TRANSPOSE (DATA=input-data-set <LABEL=label> <LET> <NAME=name> ) OUT=output-data-set (drop = _label_ _name_) <PREFIX=prefix>; BY <DESCENDING> variable-1 WHERE … (Conditions) … ; VAR (options: list variables, _all_, blank); ID variable; IDLABEL variable; COPY variable(s); Beware of pitfalls of missing observations and/or duplicate entries in the id variable

SAS Help Tip Examples: TRANSPOSE Procedure Example 1: Performing a Simple Transposition Example 2: Naming Transposed Variables Example 3: Labeling Transposed Variables Example 4: Transposing BY Groups Example 5: Naming Transposed Variables When the ID Variable Has Duplicate Values Example 6: Transposing Data for Statistical Analysis

Use divers data bases in pricing studies An example of proc transpose application in pricing and cost studies from the utility industry Use divers data bases in pricing studies Load Research (sample data of 15 min readings) Power Production (hourly costs) CIS (monthly records)

Real Life Example (slide 1) proc transpose data=bd_ets out=bd_ets2; var kwhs kws; id season daytime _name_; by year class customer bf psmadj; run;

Real Life Example (slide 2) proc transpose data=bd_ets out=bd_ets2; var kwhs kws; by year class customer bf psmadj season daytime; run; data bd_ets2; set bd_ets2; newname=left(right(_name_)||left(season)||left(daytime));run;

Real Life Example (slide 3) proc sort data=bd_ets2 out=bd_ets3; by class year customer bf psmadj newname;run; proc transpose data=bd_ets3 out=bd_ets3(drop=_name_); var col1;id newname; by class year customer bf psmadj;run;

Questions?