Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ON PATHS LESS TRODDEN… Excursions in SAS/GRAPH® PROC TABULATE and"— Presentation transcript:

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

2 PART I: PROC TABULATE

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

4 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

5 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

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

7 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

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

9 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

10 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

11 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;

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

13 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;

14

15

16

17 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

18 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

19 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>);

20

21 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

22

23

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

25 PART II: SAS/GRAPH

26 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

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

28 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

29 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

30 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

31 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

32 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

33 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;

34 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

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

36 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

37 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';

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

39 SAS/GRAPH: PROC GSLIDE
Great for text screens

40

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

42 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;

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

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

45

46 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)

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

48

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

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

51

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

53

54 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…

55

56 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

57

58

59 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

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

61 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

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

63

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

65

66 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

67

68 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…;

69 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

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

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

72 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

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

74 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)

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

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

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

78 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;

79

80 OUTPUT EXAMPLES SCANNED BY MAURA SCHREIER-FLEMING

81 QUESTIONS?


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

Similar presentations


Ads by Google