Richard DeVenezia Programmer Analyst, Johnson & Johnson

Slides:



Advertisements
Similar presentations
Making Journal-Quality Tables Nola du Toit Center for Family and Demographic Research Spring 2008.
Advertisements

Vanderbilt Business Objects Users Group 1 Reporting Techniques & Formatting Beginning & Advanced.
© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
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.
Presenter notes: This Microsoft Excel presentation is a prepackaged solution for basic Excel training. You may use the presentation as-is or customize.
Pet Fish and High Cholesterol in the WHI OS: An Analysis Example Joe Larson 5 / 6 / 09.
The University of Adelaide Table Talk: Using tables in Word Peter Murdoch March 2014 PREPARING GOOD LOOKING DOCUMENTS.
Project Implementation for COSC 5050 Distributed Database Applications Lab5.
Copyright © 2010, Meta-Xceed, Inc. All rights reserved. BI Flash and all other Meta-Xceed Inc. product or service names are registered trademarks or trademarks.
SAS PROC REPORT PROC TABULATE
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
MS Word – Mail Merge Basic Steps Create Letter/Labels general information Create Excel File with variable Data Link Files through Mail Merge in Word Print.
1 Data List Spreadsheets or simple databases - a different use of Spreadsheets Bent Thomsen.
Data Analysis Lab 02 Using Crosstabs to compare percentages.
Colleague, Excel & Word Best of Friends Presented by: Joan Kaun & Yvonne Nelson College of the Rockies.
SAS Software Version 8 The Output Delivery System.
PowerPoint Tutor Follow the directions on each slide to learn how to use some of the features of this program.
EXAM REVIEW PROJECT Microsoft Excel Exam 1. EXAM PROCEDURES 10 minutes to review project before starting 60 minutes to complete the exam In this presentation,
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Microsoft Excel – Pivot Tables Introduction to Microsoft Excel Pivot tables Please login to the computers and launch Microsoft Excel. Rob Jones Room WG43.
Spreadsheet Formatting. Formatting Is applied to spreadsheet components for the purpose of organizing and clarifying information When data is presented.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Working with Data Lists.
YET ANOTHER TIPS, TRICKS, TRAPS, TECHNIQUES PRESENTATION: A Random Selection of What I Learned From 15+ Years of SAS Programming John Pirnat Kaiser Permanente.
Prepared by the Academic Faculty Members of IT. Tables Creating Tables. Merging Cells. Splitting Cells. Sorting Tables. Performing Calculations.
BMTRY 789 Lecture9: Proc Tabulate Readings – Chapter 11 & Selected SUGI Reading Lab Problems , 11.2 Homework Due Next Week– HW6.
ODS TAGSETS - a Powerful Reporting Method Derek. 2 Agenda Understanding the tagset How to use tagsets Conclusion.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
To create text styles click on Home >> Tab under Change Styles
FINAL EXAM REVIEW 1. EXAM PROCEDURES 10 minutes to review project before starting 120 minutes to complete the exam, although most students finish in
1 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
Using Templates and Mail Merge
Excel Notes Use the handout given.
Using SAS to Create Multi-Sheet Excel Workbooks
Session #: 810 Excel 301: Take the Elevator to the Next floor: Macros Download session documents at: Presenters Name:
Introduction to SPSS July 28, :00-4:00 pm 112A Stright Hall
Using ODS Excel Migrating from DDE to ODS
Data Virtualization Demoette… Flat-File Data Sources
Chapter 6: Modifying and Combining Data Sets
Creating an Accessible Document
Getting SASsy with Enterprise Guide
Microsoft Office 2013 Coming to a PC near you!.
Page Layout Header & Footer Font Styles Image wrapping List Styles
Learning Excel Session 9 and 10 Dr. Chaitali Basu Mukherji.
Tamara Arenovich Tony Panzarella
Chapter 4: Sorting, Printing, Summarizing
Lab 2 Data Manipulation and Descriptive Stats in R
PROC DOC III: Self-generating Codebooks Using SAS®
Spreadsheet Formatting
Spreadsheet Formatting
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Spreadsheet Formatting
Spreadsheet Formatting
Spreadsheet Formatting
Never Cut and Paste Again
Spreadsheet Formatting
Lab 2 HRP223 – 2010 October 18, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
Introduction to SAS Essentials Mastering SAS for Data Analytics
Spreadsheet Formatting cleanvideosearch
Purpose Real life scenario: I have a set of reports to refresh every month but data is only available at any day during Day 3 – 5 at beginning of each.
Bent Thomsen Institut for Datalogi Aalborg Universitet
Performing Calculations on Data
Chapter 2 Excel Extension: Now You Try!
Presentation transcript:

Richard DeVenezia Programmer Analyst, Johnson & Johnson Presenter Richard DeVenezia Programmer Analyst, Johnson & Johnson  Richard has worked at Johnson & Johnson in the Medical Device Epidemiology group for two years. He has been a SAS programmer and system developer in a wide range of industries and roles since 1990.

Tips and Tricks for PROC TABULATE ODS EXCEL Tips and Tricks for PROC TABULATE

ODS Excel Now in Production SAS9.4M3 Good bye tagsets.ExcelXP Good bye custom options()  Hello online documentation Technical support

Medical Devices Epidemiology group Study Medical Devices Epidemiology group Protocol document Retrospective observational study for xyz… Details for cohort selection ICD-9 Procedures, Age, Elective, etcetera Partitions according to treatment / operant classification vars Details for study variables Binary flags – Conditions or event occurrence Categorical – Demographic, characteristic, etcetera Continuous – $, time, bmi, units

Summary Report in Excel Counts and Column %s Tabs for different variable groups (not by groups) Each tab One or more TABULATES Similar look

Summary Report in Excel Counts and Column %s Columns Same in each tab Partition variables

Summary Report in Excel Can go on and on

Tabs One macro per tab Flexible Consistent and not constraining Each macro does some things the same Tweaks for special conditions for sets of variables Nested row headers

One macro per tab ods excel ... %Dataset %ProcedureCharacteristics %PatientCharacteristics %ProviderCharacteristics %DischargeStatus %ComorbidityIndices %ElixhauserCharlson %PrimaryDiagnosis %DxTreatment %NEC %Devices %Outcomes %Readmission ods excel close;

Guarantee new tab Prior programs used Tagsets.ExcelXP New sheet_name always worked Not so in 9.4M2 Work around used in each macro %macro new_sheet(name=); ODS EXCEL OPTIONS(SHEET_INTERVAL="TABLE" SHEET_NAME=&NAME); ODS SELECT NONE; DATA _NULL_; DCL odsout obj(); RUN; ODS SELECT ALL; ODS EXCEL OPTIONS(SHEET_INTERVAL="NONE" SHEET_NAME=&NAME); %mend;

Goal is understood How to make it happen ? Macros need to be coded Iterations Layout Updated data Variables Sub-cohort Updated classification

TIP Avoid File is in use ERROR: File is in use Avoid two submits going to same file ODS EXCEL FILE=%NextFilename(StudyDataReview); … ODS EXCEL FILE=%NextFilename(StudyDataReview); %macro NextFilename (basename); %global nextfile; %let nextfile = "%sysfunc(pathname(WORK))\&basename (%sysfunc(DATE(),yymmdd10.)) #%sysfunc(monotonic()).xlsx" ;&nextfile %mend;

Avoid running whole program TIP Avoid running whole program … couple of lines of SAS code … data _null_; abort cancel; run; … thousands of lines of SAS code …

Proc TABULATE TABLE statement From SAS Docs TABLE <<page-expression,> row-expression,> column-expression </ table-option(s)>; TIP: A variables role is set by listing it in a CLASS or VAR statement Categorical -> CLASS Continuous -> VAR Binary -> VAR

Simple to complex Iterative process Hands on learning By example By variation proc tabulate data=SGF17; class type approach; table n, type*approach; label type = 'Surgery'; label approach = 'Technique'; run;   Surgery Left Hemicolectomy Sigmoidectomy Technique Lap Open N 3866 4602 19027 13922

Simple to complex Remove the variable names and have commas for the counts.   Surgery Left Hemicolectomy Sigmoidectomy Technique Lap Open N 3866 4602 19027 13922 proc tabulate data=SGF17; class type approach; table n*f=comma9., type=''*approach=''; run; Left Hemicolectomy Sigmoidectomy Lap Open N 3,866 4,602 19,027 13,922

Simple to complex Add total columns for type and approach class type approach; table n*f=comma9. , (all type='') * (all approach='') ; All Left Hemicolectomy Sigmoidectomy Lap Open N 41,417 22,893 18,524 8,468 3,866 4,602 32,949 19,027 13,922

Simple to complex That’s too much ALL. I need only a single ALL column for the N=41,417 Dimensional expressions are powerful constructs class type approach; table n*f=comma9. , all type='' * approach='';   All Left Hemicolectomy Sigmoidectomy Lap Open N 41,417 3,866 4,602 19,027 13,922

Simple to complex TRICKY N counts in the column headers. SUMMARYize column hierarchy levels as types () ()*(type) ()*(type)*(approach) Merge counts at each level into original data as (n=##,###) table n*f=comma9. , all level0_count='' * type='' * level1_count='' * approach='';   All (n=41,417) Left Hemicolectomy Sigmoidectomy (n=8,468) (n=32,949) Lap Open N 41,417 3,866 4,602 19,027 13,922

Simple to complex TIP Use a macro for column expression %macro columns_TypeApproach; all type = ' ' * approach = ' ' %mend; %macro columns_TypeApproach_withCounts; level0_count='' * type='' * level1_count='' * approach=''

Simple to complex TIP Use a macro for column expression %macro columns_TypeApproach; all type = ' ' * approach = ' ' %mend; %macro columns_TypeApproach_withCounts; level0_count='' * type='' * level1_count='' * approach=''

Simple to complex Make SIGMOID and OPEN appear first in the column headers. Order by format or value class level0_count level1_count; class type / descending; class approach / preloadfmt order=data; format approach $OpenLap.;   table n*f=comma9. , %columns_TypeApproach ;   All Sigmoidectomy Left Hemicolectomy Open Lap N 41,417 13,922 19,027 4,602 3,866

Boost – Leading spaces Trick Value transformation Or custom format (CLASS / ORDER=FORMATTED) data letters; do letter = 'A0'x||'A', 'B', ' C', 'D', 'E', 'F'; output; end; run; proc tabulate data=letters; class letter; table n, letter;   letter C B D E F  A N 1

Rows Categorical age, gender and payer proc tabulate data=SGF17_v2;   Sigmoidectomy Open Lap Age 1,486 2,862 18-44 N 45-54 2,929 4,832 55-64 3,782 5,360 65-74 3,406 4,055 75 plus 2,319 1,918 Gender 7,539 9,863 Female Male 6,383 9,164 Payer 5,798 5,986 Medicare Medicaid 792 736 Commercial 6,347 11,253 Other 985 1,052 proc tabulate data=SGF17_v2; %colvars_TypeApproach_slim; class age gender std_payor; table (age gender std_payor) * n*f=comma9. , %columns_TypeApproach_slim ; run;

Simple to complex Reduce the font, show COLPCTN, no stat label   Sigmoidectomy Open Lap Age 10.67 15.04 18-44 45-54 21.04 25.40 55-64 27.17 28.17 65-74 24.46 21.31 75 plus 16.66 10.08 Gender 54.15 51.84 Can you fix these combined cells? Female Male 45.85 48.16 Payer 41.65 31.46 Medicare Medicaid 5.69 3.87 Commercial 45.59 59.14 Other 7.08 5.53 proc template; define style sdf17_sample;   style Header from _self_ / fontsize=8pt; table (age gender std_payor) * colpctn=' '*f=6.2 , %columns_TypeApproach_slim ;

Simple to complex No merged cells, distinguish the names from values   Sigmoidectomy Make the numbers look like this Open Lap Age   18-44 10.67 15.04 11%   45-54 21.04 25.40 21%   55-64 27.17 28.17 27%   65-74 24.46 21.31 24%   75 plus 16.66 10.08 Etc… Gender   Female 54.15 51.84   Male 45.85 48.16 class age gender std_payor / style=[background=lightblue];   classlev age gender / style= [background=white pretext='a0a0'x]; table (age gender) * colpctn=''*f=6.2 , %columns_TypeApproach_slim / nocellmerge

Simple to complex Values as numbers with % after them table (age gender) * colpctn=''*f=9.2 * [s=[tagattr='format:0\%;;-_)']] , %columns_TypeApproach_slim / nocellmerge ;   Sigmoidectomy Open Lap Age   18-44 11% 15%   45-54 21% 25%   55-64 27% 28%   65-74 24%   75 plus 17% 10% Gender   Female 54% 52%   Male 46% 48%

Most complex Cause Excel formula via tagattr … *[s=[tagattr='formula:RC[2]&char(32)&"("&TEXT(RC[4],"0.00%")&")"']] sum='n'*f=comma9. mean='%'*f=9.4*[s=[tagattr='format:0.00%;;-_)']] )

Incorrect TAGATTR can make problems Debugging Incorrect TAGATTR can make problems Rename .xlsx as .zip, review .xml Here is a sample of the destination xml when the formula was not quite right <row r="8" ht="12" customHeight="1"> <c r="A8" s="7" t="s"><v>12</v></c> <c r="B8" s="8"><f>D8&</f></c> <c r="C8" s="8"><f>E8&</f></c>

Thanks !

Don't Forget to Provide Feedback! Go to the Agenda icon in the conference app. Find this session title and select it.  On the sessions page, scroll down to Surveys and select the name of the survey.  Complete the survey and click Finish.