ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH® PROC TABULATE and

Slides:



Advertisements
Similar presentations
Chapter 9 Creating Graphs in Illustrator. Objectives Create a graph Edit a graph using the Graph Data window Use the Group Selection tool Use the Graph.
Advertisements

SPSS Statistical Package for the Social Sciences is a statistical analysis and data management software package. SPSS can take data from almost any type.
The gchart Procedure The gchart Procedure is used to create bar charts of various types (it can also create pie charts. It’s most basic form would look.
Basic Descriptive Statistics Percentages and Proportions Ratios and Rates Frequency Distributions: An Introduction Frequency Distributions for Variables.
PROC GREPLAY With Templates December 5, 2008 Barry Hong Process Analysis and Simulation U. S. Steel Canada © 2008 United States Steel Corporation.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Tips & Tricks MASUG02/18/2005. Multiple Graphs on One Page.
Chapter 9 Creating and Designing Graphs. Creating a Graph A graph is a diagram of data that shows relationship among a set of numbers. Data can be represented.
TS02 SAS GTL - Injecting New Life into Graphs
A Picture Is Worth A Thousand Words. DAY 7: EXCEL CHAPTER 4 Tazin Afrin September 10,
Microsoft ® Office Excel 2007 Working with Charts.
Introduction to SAS/Graph 9.2 Ken Barz Colorado Prevention Center 22Oct2009 Ken Barz Colorado Prevention Center.
Copyright 2006 South-Western/Thomson Learning Chapter 12 Tables.
Graphs in Physics PowerPoint #4. A graph is… A convenient way to show data.
Session 9 Managerial Spreadsheet Modeling -- Prof. Juran1.
ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH ® and PROC TABULATE Presented by Aaron Rabushka © Aaron Rabushka 2000.
Statistical Graphics for the SAS System Computing for Research I 01/29/2014 Nathaniel L Baker.
Effective SAS greplay’ing and how to avoid stretching By David Mottershead Senior Programmer, Quanticate.
PROC GPLOT GPLOT is used to make two dimensional scatter-plots. General Syntax: proc gplot data=data-set options; plot y-variable*x-variable/options; run;
Chapter 15: Spreadsheet and Worksheet Basics Lesson 96: Worksheets with Charts © 2010, 2006 South-Western, Cengage Learning.
CA II Excel Lessons 8. Lesson 8 Terms √ Chart Types√Chart Properties√Other Terms bar graph Data labels chart column chart Data markers chart sheet line.
SAS/GRAPH The Basics. Today’s Topics GOPTIONS GPLOT GCHART GCONTOUR G3D.
Spreadsheet Vocabulary Multimedia Lab Kathleen Pape.
Creating Charts Ms. Hall Spring Using the Insert Tab to Create Charts The Insert tab contains the command groups you’ll use to create charts in.
EXCEL LESSON 12 CREATING CHARTS VOCABULARY. AXIS A line bordering the chart plot area used as a frame of reference for measurement.
Behind the Scenes with SAS®: Using Customer Graphics in SAS® Output Louise Hadden Abt Associates Inc.
CHART COMPONENTS Excel. COMPONENTS OF CHARTS AND GRAPHS ▪ The y-axis is the left vertical side of the graph. It contains the numerical data. ▪ The x-axis.
Data organization and Presentation. Data Organization Making it easy for comparison and analysis of data Arranging data in an orderly sequence or into.
Descriptive Statistics: Tabular and Graphical Methods
Descriptive Statistics: Tabular and Graphical Methods
Data Visualization basics Petar Horozov Nikolay Nedyalkov
Excel Lesson 8 Working with Charts
Lesson 5: Viewing and Printing Workbooks
Module 4: Building Reports
Creating, formatting, and editing graphs using Google Sheets
Working with Charts © 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Guilford County SciVis V105.01
INTRODUCTION TO SPREADSHEET APPLICATIONS
Excel Part 4 Working with Charts and Graphics
Graphics GrowingKnowing.com © 2013.
Tutorial 4: Enhancing a Workbook with Charts and Graphs
Computer Fundamentals
Chapter 8: ODS Graphics ODS graphics were not available prior to SAS 9.2 They have been implemented across a wide range of procedures Functionality isn’t.
Excel Part 4 Working with Charts and Graphics
Microsoft PowerPoint 2003 Illustrated Introductory
Graphical Displays of Data
Unit 4: Using Spreadsheets to Make Economic Choices Lessons 20–26
Using Themes to Present Information
Microsoft Excel Illustrated
CHAPTER 1: Picturing Distributions with Graphs
8.04 Spreadsheet Charts 8.04 Spreadsheet Charts.
Lecture 3 part-2: Organization and Summarization of Data
Microsoft Office Illustrated Introductory, Windows XP Edition
Formatting a Workbook Part 1
Navya Thum February 06, 2013 Day 5: MICROSOFT EXCEL Navya Thum February 06, 2013.
Building Worksheet Charts
Computing for Research I 01/26/2011 N. Baker
exploring Microsoft Office 2013 Plus
Ch 1 G’raph Science.
Descriptive Analysis and Presentation of Bivariate Data
Statistical Reasoning
Making a Publication-quality Graph in SAS
Charts A chart is a graphic or visual representation of data
Excel Lesson 8 Working with Charts
Microsoft Office Illustrated Fundamentals
Excel for Educators Class Notes
Let’s review some of the statistics you’ve learned in your first class: Univariate analyses (single variable) are done both graphically and numerically.
Presentation transcript:

ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH® PROC TABULATE and Presented by Aaron Rabushka © Aaron Rabushka 2000

PART I: PROC TABULATE

PROC TABULATE: GENERAL Powerful Tricky has its own book: The SAS Guide to TABULATE Processing

PROC TABULATE: GENERAL Often used as a big brother to PROC FREQ to display counts and sums that require more than two levels of nesting on a page Can aggregate any level of its elements’ detail label formatting can help distinguish aggregations of variables

PROC TABULATE: TYPES OF VARIABLES Uses two kinds of variables: classification variables CLASS statement can be either numeric or character variables can be grouped with a FORMAT statement default statistic is N

CODE EXAMPLE PROC TABULATE DATA=HOLDOUT.AUDIT NOSEPS; CLASS ZONE DAYNUM SYSID;

PROC TABULATE: TYPES OF VARIABLES Uses two kinds of variables: – classification variables • CLASS statement • can be either numeric or character variables • can be grouped with a FORMAT statement • default statistic is N analysis variables VAR statement must be numeric default statistic is SUM

CODE EXAMPLE VAR CPUTIME EXCTIME; PROC TABULATE DATA=HOLDOUT.AUDIT NOSEPS; CLASS ZONE DAYNUM SYSID; VAR CPUTIME EXCTIME;

PROC TABULATE: INTERRELATING VARIABLES CONCATENATION can concatenate variables and statistics to each other in any dimension CROSSING (nesting) reveals much of the power of PROC TABULATE can cross variables and statistics with each other and also with formats

PROC TABULATE: DIMENSIONS OF DISPLAY Can aggregate and display the aggregations in three dimensions (in ascending order of necessity): column row page Dimensional specifications are separated with commas and can be quite complex

CODE EXAMPLE TABLES ZONE,DAYNUM*SYSID, N CPUTIME*SUM EXCTIME*SUM; PROC TABULATE DATA=HOLDOUT.AUDIT; CLASS ZONE DAYNUM SYSID; VAR CPUTIME EXCTIME; TABLES ZONE,DAYNUM*SYSID, N CPUTIME*SUM EXCTIME*SUM;

PROC TABULATE: DIMENSIONS OF DISPLAY Can aggregate in any dimension with ALL can use labels to distinguish levels of aggregation

CODE EXAMPLE TABLES ZONE, PROC TABULATE DATA=HOLDOUT.AUDIT NOSEPS; CLASS ZONE DAYNUM SYSID; VAR CPUTIME EXCTIME; TABLES ZONE, (DAYNUM='DAY' ALL='ALL DAYS')*(SYSID ALL='ALL SYSTEMS'), N=‘NUMBER OF STEPS’*F=9. CPUTIME*SUM EXCTIME*SUM;

PROC TABULATE: DIMENSIONS OF DISPLAY Can aggregate in any dimension with ALL can use labels to distinguish levels of aggregation Can also group data over pages with a BY statement--works if there is no need to aggregate across BY groups

PROC TABULATE: AVAILABLE STATISTICS Can display many of the statistics available through PROC MEANS Percentages: PCTN (the percentage a cell comprises of a count) and PCTSUM (the percentage that a cell comprises of a sum) it is IMPERATIVE and often tricky to use the correct denominator! wise to test on “easy” data before applying it to the real data

CODE EXAMPLE TABLES ZONE, PROC TABULATE DATA=HOLDOUT.AUDIT; CLASS ZONE DAYNUM SYSID; VAR CPUTIME EXCTIME; TABLES ZONE, (DAYNUM='DAY' ALL='ALL DAYS')*(SYSID ALL='ALL SYSTEMS'), N=‘NUMBER OF STEPS’*F=9. PCTN<SYSID ALL> CPUTIME*(SUM PCTSUM<SYSID ALL>) EXCTIME*(SUM PCTSUM<SYSID ALL>);

PROC TABULATE: DOWNLOADING OUTPUT Transfer as text May help to eliminate cell separators with the NOSEPS and/or FORMCHAR pro: this can make the output easier to work with in a spreadsheet con: this can make the output confusing to interpret by obscuring inter-cell relationships

PROC TABULATE: LIMITATIONS Can consume large (perhaps excessive) amounts of CPU time Version 8 is the first to include an OUTput dataset

PART II: SAS/GRAPH

SAS/GRAPH: OUTPUT Connects with output equipment using appropriate GOPTIONS and JCL Can print output directly from the mainframe or download to a PC and process with Adobe Acrobat® Can also output directly to Intranet/Internet

SAS/GRAPH: COORDINATES SAS/GRAPH measures coordinates from the upper left corner of the page

SAS/GRAPH: TEXT Can control any text in the output headings axes footnotes annotations Can control many aspects of text in the output font color weight slant

SAS/GRAPH: ANNOTATIONS Add text to the outputs from SAS/GRAPH PROCs Stored in a SAS dataset that includes text of the annotation a value to link it to the input for the PROC formatting information

SAS/GRAPH: COLORS Can control colors of many elements of output, including text figures borders Realization is device-dependent--colors may show up differently on (e.g.,) monitors and printers SAS can assign a default sequence of colors, or programmers can select sequences that they want

SAS/GRAPH: COLORS Can use several naming schemes: SAS idiomatic color names eight pages of choices in the Version 6 manual RGB (RED/GREEN/BLUE) scheme HLS (HUE/LIGHTNESS/SATURATION) scheme grey-scale scheme

SAS/GRAPH: PATTERNS SAS can assign a default sequence or programmers can determine a sequence Pattern designations other than SOLID and EMPTY depend on the direction and density of their lines and sometimes on the type of output

CODE EXAMPLE * ASSIGN SOME PATTERNS AND COLORS; * SOLID FILLS: ; PATTERN1 VALUE=SOLID COLOR=PAB; PATTERN2 VALUE=SOLID COLOR=BLUE; PATTERN3 VALUE=SOLID COLOR=GREEN; * SLANTED LINES: ; PATTERN4 VALUE=L2 COLOR=DER; * CROSS-HATCHING: ; PATTERN5 VALUE=X4 COLOR=ORANGE;

SAS/GRAPH: AXES Can create individual definitions of axes, then assign them in SAS/GRAPH PROCs Similar to creating SAS TITLEs Can assign attributes including length, scale, color, tick-markings, and attributes of text Vertical or horizontal status is assigned in the PROCs rather than the AXIS definitions

CODE EXAMPLE * AXIS DEFINITIONS; AXIS1 LABEL=('MAINFRAME PRINTERS' HEIGHT=3) VALUE=(HEIGHT=1) ORDER='TPK' '3800' 'PRT' 'PAYR' 'STP' 'OTH'; AXIS2 ORDER=(O TO &MAXPAGES BY 20000) LABEL=(' ') VALUE=(HEIGHT=1);

SAS/GRAPH: LEGENDS SAS/GRAPH has its own legend facility Can also use FOOTNOTEs as legends can string SPECIAL-font K’s (case-sensitive) together to produce color bands

CODE EXAMPLE FOOTNOTE1 HEIGHT=1 BOX=3 FONT=SPECIAL COLOR=VIR 'KKK ' FONT=SWISSB COLOR=BLACK 'TOPEKA ' FONT=SPECIAL COLOR=MOR 'KKK ' FONT=SWISSB COLOR=BLACK '3800 ' FONT=SPECIAL COLOR=GREEN 'KKK ' FONT=SWISSB COLOR=BLACK 'OTHER';

SAS/GRAPH: THE G-PREFIX All SAS/GRAPH PROCs begin with G- Requires a special set of SAS options--GOPTIONS

SAS/GRAPH: PROC GSLIDE Great for text screens

SAS/GRAPH: PROC GSLIDE Great for text screens every element may need an observation in an ANNOTATE dataset

CODE EXAMPLE *BUILD AN ANNOTATION DATASET FOR A SLIDE: ; DATA NOTES; SET ALLDAY; *OUTPUT THE DATE: ; X = 40; Y = 55 - (_N_ * 5); FUNCTION='LABEL'; COLOR = 'BLACK'; STYLE = 'SWISSB'; TEXT=PUT(DATE,WORDDATE18.); OUTPUT;

CODE EXAMPLE (cntd.) * OUTPUT THE NUMBER OF PAGES: ; X=90; Y=55 - (_N_ - 5); FUNCTION='LABEL'; IF COUNT >= 100000 THEN COLOR='RED'; ELSE COLOR='GREEN'; STYLE='SWISSB'; TEXT=PUT(COUNT,COMMA9.); OUTPUT;

CODE EXAMPLE (cntd.) * TEXT SLIDE FROM THE PRECEDING ANNOTATIONS: ; PROC GSLIDE ANNOTATE=NOTES GOUT=PANELS; TITLE1 HEIGHT=3 'PAGES PRINTED, BY DAY';

SAS/GRAPH: PROC GSLIDE • Great for text screens – every element may need an observation in an ANNOTATE dataset also generates some graphics of its own (e.g., bar charts)

SAS/GRAPH: PROC GCHART Provides many standard graphing capabilities: star charts block charts pie charts

SAS/GRAPH: PROC GCHART Provides many standard graphing capabilities: star charts block charts pie charts bar charts

SAS/GRAPH: PROC GCHART BAR CHARTS horizontal bars (HBAR)

SAS/GRAPH: PROC GCHART BAR CHARTS horizontal bars (HBAR) vertical bars (VBAR)

CODE EXAMPLE PROC GCHART DATA=PRINTOUT; VBAR DEVNAME / ANNOTATE=LABELS SUMVAR=PAGES PATTERNID=MIDPOINT AUTOREF MAXIS=AXIS1 RAXIS=AXIS2 CFRAME=LIGR COUTLINE=DAPB; TITLE1 "PAGES PRINTED BY DEVICE FROM &FMDATE TO &TODATE"; FOOTNOTE1…

SAS/GRAPH: PROC GCHART BAR CHARTS horizontal bars (HBAR) vertical bars (VBAR) can group bars with a GROUP statement and stack them with a SUBGROUP statement

SAS/GRAPH: PROC GCHART Interesting use of the term “midpoint” to mean “category” not used in its strict mathematical sense to mean the half-way point between the two ends of a quantitative continuum can be used for any value, grouped or elemental, of a numeric or character variable

SAS/GRAPH: PROC GPLOT Cannot connect values in PROC GCHART-- need to use GPLOT

SAS/GRAPH: PROC GPLOT Can use SAS’s default symbols, or programmers can select which to use Can assign SYMBOL definitions comparably to AXIS or TITLE definitions Can use some pre-defined SAS symbols (e.g., DOT, SQUARE, DIAMOND) or can use letters, including their analogues in SPECIAL and MARKER fonts

SAS/GRAPH: PROC GPLOT Joining symbols: INTERPOLATION options no joining required

SAS/GRAPH: PROC GPLOT Joining symbols: INTERPOLATION options no joining required lines (straight lines)

SAS/GRAPH:. PROC GPLOT Joining symbols: SAS/GRAPH: PROC GPLOT Joining symbols: INTERPOLATION options – no joining required – lines (straight lines) splines (curved lines) needles join symbols to the x-axis rather than to each other can be made to look like bars on a bar graph

CODE EXAMPLE SYMBOL1 VALUE=NONE WIDTH=90 INTERPOL=NEEDLE COLOR=RED; SYMBOL2 VALUE=N HEIGHT=2 FONT=MARKER INTERPOL=JOIN COLOR=ORANGE; SYMBOL3 VALUE=O HEIGHT=2 FONT=MARKER INTERPOL=JOIN COLOR=VIR; SYMBOL4 VALUE=P HEIGHT=2 FONT=MARKER INTERPOL=JOIN COLOR=MOR; PROC GPLOT DATA=TRNSDATE GOUT=PANELS; PLOT (PRT STP TOP _3800)*ENDDATE / HAXIS=AXIS1 VAXIS=AXIS2 OVERLAY; TITLE1…; TITLE2…; FOOTNOTE1…;

SAS/GRAPH: PROC GPLOT Several plots on a single graph OVERLAY option: several plots keyed to a single set of axes PLOT2 option: one or more plots keyed to the same x-axis as the first set of plots and to a second y-axis printed on the graph’s right

SAS/GRAPH: PROC GREPLAY Great for presenting output from several SAS/GRAPH procedures as panels on a single page

SAS/GRAPH: PROC GREPLAY Use a template partly generated through PROC GSLIDE and assigned in PROC GREPLAY

SAS/GRAPH: PROC GREPLAY Requires an internal (to the SAS job) catalog of output from preceding procedures created by GOUT (graph output) clauses in preceding procedures

CODE EXAMPLE PROC GSLIDE GOUT=PANELS; TITLE1 HEIGHT=3 "THREE PANELS ON A PAGE"; RUN;

SAS/GRAPH: PROC GREPLAY Requires an interior (to the SAS job) catalog of output from preceding procedures created by GOUT (graph output) clauses in preceding procedures referenced in GREPLAY with the IGOUT (input graph output catalog)

CODE EXAMPLE PROC GSLIDE GOUT=PANELS; TITLE1 HEIGHT=3 "THREE PANELS ON A PAGE"; RUN; PROC GREPLAY IGOUT=PANELS TC=TEMPCAT NOFS;

SAS/GRAPH: PROC GREPLAY Need to assign proper co-ordinates for each corner of each panel

CODE EXAMPLE (cntd.) * DEFINE A TEMPLATE; TDEF THREEPAN DES='THREE PANELS' /* PANEL 1--UPPER HALF */ 1/ LLX=0 LLY=50 ULX=0 ULY=95 URX=100 URY=95 LRX=100 LRY=50 /* PANEL 2--LOWER LEFT */ 2/ LLX=0 LLY=0 ULX=0 ULY=50 URX=50 URY=50 LRX=50 LRY=0 /* PANEL 3--LOWER RIGHT */ 3/ LLX=50 LLY=0 ULX=50 ULY=50 URX=100 URY=50 LRX=100 LRY=0 /* PANEL 4--FOR FRAMING THE REST */ 4/ LLX=0 LLY=0 ULX=0 ULY=100 LRX=100 LRY=0 URX=100 URY=100;

CODE EXAMPLE (cntd.) * ASSIGN THE PRECEEDING TEMPLATE FOR USE.; TEMPLATE=THREEPAN; * REPLAY PRECEDING OUTPUT INTO THE TEMPLATE'S PANELS.; TREPLAY 1:GSLIDE 2:GCHART 3:GCHART1 4:GSLIDE1;

OUTPUT EXAMPLES SCANNED BY MAURA SCHREIER-FLEMING

QUESTIONS?