Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to Build Tabular Dashboards Using Proc Report

Similar presentations


Presentation on theme: "How to Build Tabular Dashboards Using Proc Report"— Presentation transcript:

1 How to Build Tabular Dashboards Using Proc Report
Shana Bereznay ACS Raff Rushton IBM Frank Bereznay Credit Raff for Original Idea Wanted to share what he came up with

2 Agenda Management Reporting Dashboard Organization How to Build
Two Phases Related Reporting How to Automate Notification Summary / Questions Just read the agenda OK to ask questions any time, especially SAS questions

3 Management Reporting A very key point…
There is no single right way Beauty is in the eye of the beholder Tabular vs Graphical Representation Read the slide Here is an example

4 A Tabular View of Some Data
A lot of valuable information , but the presentation is visually neutral. Compare this to a graphical display of a subset of the data.

5 A Graphical View of the Same Data
Some key points with graphs like this. We naturally see a time series for the x axis, so we are looking at a time series analysis of some sort. One bar in each graph is for a specific date so we are looking at before and after upgrade analysis Gets the main point across, but lacks the presentation details or density of the tabular presentation Key theme of Tufte’s ‘rules’. Provide the reader of the document as much data as possible and Allow him to derive the infformation content out of the data.

6 Management Reporting A very key point…
There is no single right way Beauty is in the eye of the beholder Tabular vs Graphical Representation Some Common Themes Time Series Data Analysis Drill Down Capability Threshold based Exception Alerting Do Something if you see a ‘problem’ No matter how we present the data we have some common themes in our field. We generally deal with time series data analysis Complex data that needs to be explored Comparing metrics against established or expected thresholds to look for exceptions Do something if you see a problem Over time, we gravitated to the tabular dashboard as a way to satisfy these reporting requirements

7 Dashboard Organization
Review key themes Well suited for time series data, natural left to right progression of data values Linked cells provide a intuitive drill down capability Color coding of cells allow for exceptions to be highlighted. Behind the scenes we can generate alerts based on any business rule or exception value Best of all, this is very easy to build (a little tedius at times) and requires base SAS

8 How to Build Phase I Phase II Create Unattributed Dashboard
Design Dashboard Code Proc Report Statements Phase II Attribute Cells Add links to related reporting Add format to color cell background More like a set of general guidelines than a specific coding requirement or standard. Describe the two phases Unattributed Dashboard Attribute Cells

9 Phase I Design Wysiwyg design style
Draw the dashboard on paper or in EXCEL The starting point or foundation is the metric(s) you want to report on. Resource in this example The date range is to the right of the resource column along with the derivation of the metric to be displayed Left hand side of resource column is used to group / categorize / summarize Very simple layout, but an important starting point

10 Example 1 – SAS Code LibName VelSoft "&Path\VelSoft";
ODS Html File="&Path\VelSoft\Example_1.html" Style=Statistical; ODS Listing Close; ODS Html; Proc Report Data=VelSoft.XAMCPUBY NoWindows; Column Serial Startime CPUUtil; Define Serial /'Serial' Group; Define Startime /'Date' Group Format=Datetime7.; Define CPUUtil /'Mean Busy' Analysis Mean Format=4.1; Where DatePart(Startime) Between '01Mar10'd and '05Mar10'd and Serial In ('04E910','05D3A0'); Title1 "Proc Report Example 1 – List of Data with Average Calculated"; Title2 "Reporting on two zVM Instances to Save Space"; Run; ODS Html Close; ODS Listing; First example is to introduce Proc Report Items to note Column statement defines what is displayed and in what order Define statements provide attributes for the variables to be displayed Group is like ID combined with BY on a Proc Print Interaction between Startime (formatted value) and how the mean is calculated. The dataset being processed is 15 minute interval data Lets look at the result Before that brief ODS discussion

11 Example 1- Output Very simple and straight forward
Three variables on the column statement and three columns get printed. Note the single reported value per day based on the format specified for startime. Simple, but not the left to right order we wanted so we will introduce the across variable in the second example

12 Example 2 – SAS Code LibName VelSoft "&Path\VelSoft"; Data XAMCPUBY;
Set VelSoft.XAMCPUBY; LPAR = Serial; Env = Serial; Cat = 'CPU'; ODS Html File="&path\VelSoft\Example_2.html" Style=Statistical; ODS Listing Close; ODS Html; Proc Report Data=XAMCPUBY NoWindows; Column Env LPAR Cat Startime, CPUUtil; Define Env / '' Group Format=$Env.; Define LPAR / '' Group Format=$LPAR.; Define Cat / '' Group Format=$Cat.; Define Startime / '' Across Format=Datetime7.; Define CPUUtil / '' Analysis Format=4.1 Mean Width=7; Where DatePart(Startime) Between '01Mar10'd and '05Mar10'd; Title1 "Proc Report Example 2 - Use of the Across Parameter and Grouping Variables”; Run; ODS HTML Close; ODS Listing; This example fills out the left hand side categorization columns and uses the across variable to get the left to right visual we desire Note data step at top to create some additional categorization variables. Setting up a dashboard that will handle multiple types of resources, reason for the Cat variable (category) Start with column statement again, this time we have five variables and a comma What is the comma for? Nesting Hierarchy Puts metric value beneath the data variable. Notice we have removed the column header titles, the organization of the data is now intuitive Go over the defines Lets see how this looks

13 Example 2 - Output Success – We now have the left to right orientation of the data we wanted and notice how intuitive the presentation of the data is. No column headings needed now However, we want to show 30 days of data on a single non scrolled web page and this presentation density is not going to accommodate that. Next step is to introduce ODS style statement to increase the presentation density

14 Example 3 – SAS Code LibName VelSoft "&Path\VelSoft"; Data XAMCPUBY;
Set VelSoft.XAMCPUBY; LPAR = Serial; Env = Serial; Cat = 'CPU'; ODS Html File="&path\VelSoft\Example_3.html" Style=Statistical; ODS Listing Close; ODS Html; Proc Report Data=XAMCPUBY headline headskip missing Style(Report)={Background=Black CellSpacing=1MM CellWidth=1MM} Style(Column)={Font_Size=10PT} Style(Header)={Foreground=Black Background=White Font_Size=10PT}; Column Env LPAR Cat Startime, CPUUtil; Define Env / '' Group Format=$Env.; Define LPAR / '' Group Format=$LPAR.; Define Cat / '' Group Format=$Cat.; Define Startime / '' Across Format=DTDate5.; Define CPUUtil / '' Analysis Mean Format=3.; Where DatePart(Startime) Between '01Mar10'd and '12Mar10'd; Title1 "Proc Report Example 3 - ODS Style Elements"; Run; ODS HTML Close; ODS Listing; No change to the Proc Report column or define statements for this example. ODS statements are added to reduce the size of a cell. We have also increased the date range to generate more columns Notice we did not make any coding changes to introduce more columns, that is driven by the values in the data itself.

15 Example 3 - Output We have finished Phase I. We have a non attributed (no links in the cells) tabular dashboard. For some reporting this may be all that is needed. A logical intuitive presentation of time series data ranging from left to right

16 Phase I Summary Proc Report Unattributed Dashboard Easy to Use
Powerful Integrates with ODS Unattributed Dashboard May be all that is needed Read the slide Onward to Phase II – Lets attribute the cells!

17 Example 4 – SAS Code LibName VelSoft "&Path\VelSoft";
Data VelSoft.XAMCPUBY; Length URL_Trend $19.; Set VelSoft.XAMCPUBY; LPAR = Put(Serial,$LPAR.); Env = Serial; Cat = 'CPU'; URL_Trend = Cats(Cat,'-',LPAR,'-mth.html'); ODS Html File="&path\VelSoft\Example_4.html" Style=Statistical; ODS Listing Close; ODS Html; Coding got too big to be on one page so it is now split across two slides. We are going to add a link to a related trend report for each zVM LPAR Note the new variable URL_Trend So we have crated a new variable URL_Trend, lets see how we will use it.

18 Example 4 – SAS Code Proc Report Data=VelSoft.XAMCPUBY headline headskip missing; Style(Report)={Background=Black CellSpacing=1MM CellWidth=1MM} Style(Column)={Font_Size=10PT} Style(Header)={Foreground=Black Background=White Font_Size=10PT}; Column Env URL_Trend LPAR Cat Startime, CPUUtil; Define Env / '' Group Format=$Env.; Define URL_Trend/ '' Group NoPrint; Define LPAR / '' Group; Define Cat / '' Group Format=$Cat.; Define Startime / '' Across Format=DTDate5.; Define CPUUtil / '' Analysis Mean Format=3.; Compute Cat; Call Define('Cat','URLP',URL_Trend); EndComp; Where DatePart(Startime) Between '01Mar10'd and '12Mar10'd; Title1 "Proc Report Example 4 - Assigning a URL"; Run; ODS HTML Close; ODS Listing; Introducing the Compute Block A data step within the Proc Report procedure. Has many purposes, but for our use it will be the place to attribute cells. Also the NoPrint attribute on a define statement. We need a place to hold the URL_Trend value, but we don’t want it to be printed on the report page. Every time the Cat variable gets processed, the compute block is executed. Call define assigns the URL attribute to Cat and the link value specified in URL_Trend. Still very easy. A quirk about Proc Report to note. This procedure execution is literally left to right top to bottom one row at a time. Because of that the URL_Trend variable must be infront of the Cat in the column statement in order for the compute block to know its value when it is processing the Cat variable. Lets see the output

19 Example 4 - Output Point out the colored underlined link for the % CPU Busy column Nothing connected to that link yet, so don’t try to use it. Now it gets interesting, we want to assign attributed for each of the metric cells 01Mar values through 12Mar Lets see how we do that

20 Example 5 – SAS Code LibName VelSoft "&Path\VelSoft"; Data XAMCPUBY;
Length URL_Trend $19. URL_Day $23.; Set VelSoft.XAMCPUBY; Date = Datepart(StarTime); LPAR = Put(Serial,$LPAR.); Env = Serial; Cat = 'CPU'; URL_Trend = Cats(Cat,'-',LPAR,'-mth.html'); URL_Day = Cats(Cat,'-',LPAR,'-',PUT(DATE,DATE7.),'.html'); Where Date Between '01Mar10'd and '12Mar10'd; Proc Summary Nway Data=XAMCPUBY; ID CAT ENV URL_Day URL_Trend; Class LPAR Date; Var CPUUtil; Output Out=CPU_Rpt(DROP=_TYPE_ _FREQ_) P90(CPUUtil)=Metric; Data CPU_Rpt; Set CPU_Rpt; Bk_Color = Put(Metric,CPUFmt.); ODS Html File="&path\VelSoft\Example_5.html" Style=Statistical; ODS Listing Close; ODS Html; I’ve saved the best for last. Lots of changes in the this example. Now we are creating two URL links, a trend and a daily graph link for the individual daily metric cells. Again, this is being setup as a multiple resource table. This means we need to summarize the data ahead of time so we can determine the proper color to apply to the cell. Note the Proc Summary followed by the data step. Now on to the rest of the code

21 Example 5 – SAS Code Proc Report Data=CPU_Rpt headline headskip missing Style(Report)={Background=Black CellSpacing=1MM CellWidth=1MM} Style(Column)={Font_Size=10PT} Style(Header)={Foreground=Black Background=White Font_Size=10PT}; Column Env LPAR URL_Trend Cat Date, (URL_Day BK_Color Metric); Define Env / '' Group Format=$Env.; Define LPAR / '' Group Format=$LPAR.; Define URL_Trend/ '' Group NoPrint; Define Cat / '' Group Format=$Cat.; Define Date / '' Across Format=Date5.; Define URL_Day / '' Noprint; Define BK_Color / '' Noprint; Define Metric / '' Analysis Mean Format=3.; Compute Cat; Call Define('Cat','URLP',URL_Trend); EndComp; Compute Metric; Call Define( 7 ,"style",CATS("style={background=",_C6_,"}")); Call Define( 7,'URLP',_C5_); Call Define(10 ,"style",CATS("style={background=",_C9_,"}")); Call Define(10,'URLP',_C8_); Call Define(13 ,"style",CATS("style={background=",_C12_,"}")); Call Define(13,'URLP',_C11_); Repeating code blocks removed to save space Call Define(40 ,"style",CATS("style={background=",_C39_,"}")); Call Define(40,'URLP',_C38_); EndComp; Title1 "Proc Report Example 5 - Attributing Metric Cells"; Run; Quit; ODS HTML Close; ODS Listing; No change to earlier code, however we are not using the 90th percentile and we have left the mean statistic on the define statement. There will only be one observation per startime value so mean is OK Note the way URL_Day and BK_Color are part of the hierarchy (Inside the list of variables to be nested below each date, but only metric will be printed on the report. The other two are attributes with the NoPrint define parameter. Big discussion about referencing columns by number, go to the next page to show the data table

22 Example 5 - Output We have done it. A fully attributed dashboard
Natural left to right organization of the data, color coding of individual cells to highlight exception conditions and links to allow us to go to related reporting (once it has been created) Here is a production version of the dashboard

23 Production zVM Dashboard
30 days of data for five zVM LPARs and four resources being tracked for each LPAR and it all easily fits on a single browser screen. That’s presentation density!

24 Related Reporting A Very Powerful Extension to the primary data table.
Can be 1 to N layers deep. Only limit is the perseverance of the SAS programmer. Number of Reports Quickly Adds Up 5 vVM Lpars * 4 Resources * 30 Days Trend Graphs = 620 Reporting Objects Housekeeping can become an issue Read Slide

25 Related Reporting Use a Single SAS Dataset for all the reporting tasks. Simplifies Link Value tracking Subset data with Where Clause using Link Values Reporting Object Macros are a must Use Proc SQL to create ‘parameterized’ invocation code Programming Suggestions

26 Macro for Trend Reports
%Macro Mth_Trend(URL_Trend=); ODS HTML Body="&URL_Trend" Path="&Path" (URL=None); Symbol1 I=BOXJ10; Axis1 ORDER=(&STRT_DAT TO &STOP_DAT BY DAY); Axis2 Order=(0 to 100 by 10) Label=None; Proc GPLOT Data=CPU; PLOT CPUUTIL*DATE / HAXIS=AXIS1 VAXIS=AXIS2 LEGEND=LEGEND1; LABEL CPUUTIL = "Total CPU Utilization"; Where URL_Trend = "&URL_Trend"; Title1 C=BLACK H=12 "zVM systems"; Title2 H=9 C=BLACK "CPU Percent Busy -- Fifteen Minute Interval Data"; Title3 "Box Range Spans the 25th to 75th Percentile"; Title4 "Wiskers Extend to the 90th Percentile"; Run; %Mend Mth_Trend; Sample Macro – Note the URL_Trend parameter This GPLOT provides the daily drill down Note where URL_Trend is used, names the graph and subsets the input.

27 Proc SQL to Create ‘Parameterized’ SAS Code
%MACRO Gen_Mth_Stmt; Proc SQL NoPrint; Select Distinct URL_Trend Into :Trend1 - :Trend&SYSMAXLONG From XAMCPUBY; Quit; %Do I = 1 %To &SQLOBS; %Mth_Trend(URL_Trend = &&Trend&I.); %End; Run; %MEND Gen_Mth_Stmt; One way to create the customized ‘parameterized’ SAS code. Also write out and read back in.

28 Sending Email Notices Very Easy to Code in SAS
Requires some setup work by SAS support programmer and support staff. SAS views as an external file output destination. Two step process Develop list of notices to send Use Data Step or Proc Print to send them.

29 Collect the Notices Data CPU_Rpt Exceptions; Set CPU_Rpt;
If Metric = . Then Metric = 0; Bk_Color = Put(Metric,CPUFmt.); Output CPU_Rpt; Select (Bk_Color); When ('lime’,’blue'); Otherwise Output Exceptions; End; Run;

30 Send the Emails FileName MyMail EMAIL Subject=("zVM Exceptions")
TYPE="TEXT/HTML"; ODS CHTML File=MyMail; Proc Print Data=Exceptions N NOOBS; TITLE1 "zVM Exceptions"; Run; ODS CHTML Close;

31 Summary Powerful framework for reporting if your audience is receptive to tabular data. Accommodates a dense presentation format and discrete data points at the same time. Easy to create with base SAS product. Traffic lighting of data cells highlights exception conditions Drill down capability allows user to investigate.

32 Questions


Download ppt "How to Build Tabular Dashboards Using Proc Report"

Similar presentations


Ads by Google