San Francisco 2013.  Theme: Strength in Numbers  Big Data and Business Intelligence (BI) Applications.

Slides:



Advertisements
Similar presentations
Slide C.1 SAS MathematicalMarketing Appendix C: SAS Software Uses of SAS  CRM  datamining  data warehousing  linear programming  forecasting  econometrics.
Advertisements

S ORTING WITH SAS L ONG, VERY LONG AND LARGE, VERY LARGE D ATA Aldi Kraja Division of Statistical Genomics SAS seminar series June 02, 2008.
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.
HSRP 734: Advanced Statistical Methods July 24, 2008.
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.
April 25 Exam April 27 (bring calculator with exp) Cox-Regression
Some Terms Y =  o +  1 X Regression of Y on X Regress Y on X X called independent variable or predictor variable or covariate or factor Which factors.
Enough really good SAS ® tips to fill a book Arthur Tabachneck, President and CEO, myqna.org.
Plots, Correlations, and Regression Getting a feel for the data using plots, then analyzing the data with correlations and linear regression.
Logistic Regression Biostatistics 510 March 15, 2007 Vanessa Perez.
Basic And Advanced SAS Programming
Model Checking in the Proportional Hazard model
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
SAS Lecture 5 – Some regression procedures Aidan McDermott, April 25, 2005.
© Willett, Harvard University Graduate School of Education, 8/27/2015S052/I.3(c) – Slide 1 More details can be found in the “Course Objectives and Content”
Survival analysis with time-varying covariates in SAS
Efficiencies with Large Datasets Greater Atlanta SAS Users Group July 18, 2007 Peter Eberhardt.
SAS SQL SAS Seminar Series
Simple Linear Regression
A Concise Display of Multiple Response Items Patrick Thornton.
G Lecture 121 Analysis of Time to Event Survival Analysis Language Example of time to high anxiety Discrete survival analysis through logistic regression.
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.
Key Data Management Tasks in Stata
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
Lecture 6 Correlation and Regression STAT 3120 Statistical Methods I.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
SAS Macro: Some Tips for Debugging Stat St. Paul’s Hospital April 2, 2007.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
A Brief Introduction to PROC TRANSPOSE prepared by Voytek Grus for
Basic Data Quality Assurance Techniques using SAS A Guide for the Analyst on a Deadline Kevin Druhan Wait Time Improvement Office Nova Scotia Department.
2 December 2004PubH8420: Parametric Regression Models Slide 1 Applications - SAS Parametric Regression in SAS –PROC LIFEREG –PROC GENMOD –PROC LOGISTIC.
Cox Regression II Kristin Sainani Ph.D. Stanford University Department of Health Research and Policy Kristin Sainani Ph.D.
How to start using SAS Tina Tian. The topics An overview of the SAS system Reading raw data/ create SAS data set Combining SAS data sets & Match merging.
SAS Basics. Windows Program Editor Write/edit all your statements here. Log Watch this for any errors in program as it runs. Output Will automatically.
YET ANOTHER TIPS, TRICKS, TRAPS, TECHNIQUES PRESENTATION: A Random Selection of What I Learned From 15+ Years of SAS Programming John Pirnat Kaiser Permanente.
TASS Meeting Setting GuessingRows when Importing Excel Files September 19th, 2008 Setting GuessingRows when importing Excel Files Dr. Arthur Tabachneck,
SAS Basics. Windows Program Editor Write/edit all your statement here.
Time Series Data Processes by Tai Yu April 15, 2013.
SAUSAG 69 – 20 Feb 2014 Smarter Sorts Jerry Le Breton (Softscape Solutions) & Doug Lean (DHS) Beyond the Obvious.
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.
Love does not come by demanding from others, but it is a self initiation. Survival Analysis.
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.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
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.
Chapter 17 Supplement: Alternatives to IF-THEN/ELSE Processing STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South.
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Distribution A: Approved for public release; distribution is unlimited. Case Number: 88ABW , 31 Mar 2015 A Tool that Uses the SAS PRX Functions.
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.
Using SAS Stored Processes and the SAS Portal for Delivering Statistics to Drug Discovery Volker Harm PhUSE/PSI One-day Event 2009, Marlow.
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.
SAS ® Global Forum 2014 March Washington, DC Arthur Tabachneck Thornhill, ON Canada Tom Abernathy New York, NY Matt Kastin Penn Valley, PA.
03/20161 EPI 5344: Survival Analysis in Epidemiology Estimating S(t) from Cox models March 29, 2016 Dr. N. Birkett, School of Epidemiology, Public Health.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
TASS Meeting Quickly Finding Project Code March 13th, 2009 A way to quickly find all of your project code Dr. Arthur Tabachneck Director, Data Management.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
03/20161 EPI 5344: Survival Analysis in Epidemiology Testing the Proportional Hazard Assumption April 5, 2016 Dr. N. Birkett, School of Epidemiology, Public.
2012 OrlandoFlorida April 22-25, 2012 Sometimes one needs an option with unusual dates Arthur TabachneckMatthew Kastin Thornhill, OntarioLouisville, Colorado.
Statistics 262: Intermediate Biostatistics
A Better Way to Flip (Transpose) a SAS® Dataset
Increase Your Productivity by Doing Less
Automate Repetitive Programming Tasks: Effective SAS® Code Generators
Making Remote Processing Less Remote
A Better Way to Flip (Transpose) a SAS® Dataset
Changing a file from being long to being wide*
Presentation transcript:

San Francisco 2013

 Theme: Strength in Numbers  Big Data and Business Intelligence (BI) Applications

Paper : Cox Propotional Hazard Model Evaluation in one Shot. (Polina Kukhareva. Proceedings of the SAS® Global Forum 2013 Conference. Cary, NC: SAS Institute Inc. ) Martingale residual plots Tests linearity in the log scale assumption Schoenfeld residual plot to check PH

 %let predictors=age systolic_bp diastolic_bp ldl bmi diabetes smoking sex treatment activity;  %let class = diabetes(ref="0") smoking(ref="0") sex(ref="0") treatment(ref="0") activity(ref="average")  %check_Cox_assumptions_all (_NUMBER=1, _DATA=simCox, _PREDICTORS=&predictors, _class=&class, _OUTCOME=CV_event, _FU=CV_time, _STOP= activity,  _EXCLUDE= systolic_bp diastolic_bp ldl diabetes smoking sex)

 Quantlife Procedure for Survival Analysis ◦ Covariate analysis ◦ Summarize lifetime distribution by percentiles (25 th, 50 th, 75 th ) ◦ Separate regression models for each quartile proc quantlife data=pbc log method=na plot=(quantplot survival) seed=1268; model Time*Status(0)=logBilirubin logProtime logAlbumin Age Edema / quantile=( ); run;

IDDateTimeGender Score health Score mobility 122-Sep-091M Oct-092M Mar-101F Mar-102F Apr-101F Apr-102F May-101F May-102F2025

proc transpose data=have out=want (drop=_:) prefix=var1_; by idnum; var var1; id date; run;

 What would Art do?

Paper SAS Global Forum Beyond the Basics. Arthur S. Tabachneck, Ph.D., myQNA, Inc., Thornhill, Ontario Canada Xia Ke Shan, Chinese Financial Electrical Company, Beijing, China Robert Virgile, Robert Virgile Associates, Inc., Lexington, MA Joe Whitehurst, High Impact Technologies, Atlanta GA

 SAS Marco  Flips tall data sets to wide data sets or flips wide data sets to wider data sets  Macro creates and runs a program that creates a data step using arrays

 %macro transpose(libname_in=mydata, libname_out=, data=, out=, by=, prefix=, var=, autovars=, id=, var_first=, format=, delimiter=, copy=, drop=, sort=, sort_options, guessingrows=);

How the macro works if we have: dataset have idnumdatevar1var2 131MAR20131SD 130JUN20132EF 130SEP20133HK 131DEC20134HL 231MAR20135GH 230JUN20136MM 230SEP20137JH 231DEC20138MS Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013.

How the macro works and we need: dataset need idnumvar1 Qtr1 var2 Qtr1 var1 Qtr2 var2 Qtr2 var1 Qtr3 var2 Qtr3 var1 Qtr4 var2 Qtr4 11SD2EF3HK4HL 25GH6MM7JH8MS and we submit: %transpose(data=have, out=want, by=idnum, id=date, format=qtr1., delimiter=_Qtr, var=var1-var2, sort=yes) Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013.

How is it Different/Better than Proc Transpose? Does it Go Beyond Proc Transpose?

and you can use almost all the features that you can with PROC TRANSPOSE plus some additional ones %transpose(libname_in=,libname_out=, data=,out=, by=,prefix=, var=,autovars=, id=,var_first=, format=,delimiter=, copy=,drop=, sort=,sort_options=, use_varname=,preloadfmt=, guessingrows=) Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

parameter: drop the variable(s) you want dropped from the transposed file ** only relevant if you want to drop any of the by variables ** the %transpose macro's features %transpose(libname_in=,libname_out=, data=,out=, by=,prefix=, var=,autovars=, id=,var_first=, format=,delimiter=, copy=,drop=, sort=,sort_options=, use_varname=,preloadfmt=, guessingrows=) Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

%transpose(libname_in=,libname_out=, data=,out=, by=,prefix=, var=,autovars=, id=,var_first=, format=,delimiter=, copy=,drop=, sort=,sort_options=, use_varname=,preloadfmt=, guessingrows=) parameter: autovars determines whether char(acter), num(eric) or all variables should be transposed if the var parameter is null * * * * * * F E A T U R E * * * * * * Where PROC TRANSPOSE will only include all numeric variables if there is no var statement, this parameter lets you indicate if you want all numeric variables, all character variables or simply all variables the %transpose macro's features Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

parameter: sort the %transpose macro's features %transpose(libname_in=,libname_out=, data=,out=, by=,prefix=, var=,autovars=, id=,var_first=, format=,delimiter=, copy=,drop=, sort=,sort_options=, use_varname=,preloadfmt=, guessingrows=) whether the input dataset should be sorted (YES or NO): for both, only &by, &id, &var and &copy variables will be used If Yes, the input data will be sorted using the noequals option Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

What’s in it for me??

%transpose(data=have, out=want, by=idnum, var=var1, id=date, sort=yes, delimiter=_) Would you be interested in knowing how to obtain the same result with the following code? No system variables to drop No need for a prefix (var names automatically included) No need to differentiate between options and statements as they are all of the form: parameter=value, No need to presort your data Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

%transpose(data=have, out=need, by=idnum, id=date, format=qtr1., delimiter=_Qtr, var=var1-var2, sort=yes) would you be interested in knowing how to obtain the right result with the following code? only requires one step only needs one pass through the data doesn't produce distorted results can run more than 50 times faster than PROC TRANSPOSE How about if you knew that the macro: Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

Compare the performance of the following two sets of almost identical code run on a file with 40,000 records and 1,002 variables PROC SORT data=have out=need; by idnum date; run; took 2.41 seconds CPU time PROC TRANSPOSE data=need out=want (drop=_:) prefix=var1_Qtr; by idnum; var var1; id date; format date Qtr1.; run; took 0.74 seconds CPU time Art Tabachneck. A Better Way to Flip(Transpose) a SAS® Dataset. Presented at MWSUG 24, 2013

 Thanks to Art Tabachneck for providing access and sharing his slides Way_to_Flip_(Transpose)_a_SAS_Dataset