Building a 16-Page Executive Report in SAS Viya Visual Analytics
Thirty techniques, one dataset, and a few things SAS did that I did not expect.
Most of my dashboard work has been in Power BI and Tableau. This project was my first full build in SAS Viya Visual Analytics: a 16-page executive report on the Sample Superstore dataset (9,994 order lines, January 2017 through December 2020), exported as a single PDF. It was a course final project, and I used it to push through as much of the tool as I could.
This post is about the build. What I used, why, and where the tool surprised me.

The executive dashboard. The Region buttons and Category list are page prompts, and the text under the chart recalculates with them.
What is in the report
I counted 30 distinct techniques by the end. Grouped roughly:
Data preparation: source table edits, format fixes, calculated items, a calculated aggregated measure, custom categories, a geography item, two hierarchies and a saved data view.
Objects: key values, butterfly chart, dot plot, dual axis time series, step plot, geo map, list table, crosstab, box plot, donut chart, word cloud, dual axis bar chart and a data-driven content object.
Interactivity: page prompts, dynamic text, object filters, a common filter shared across charts, a data source filter, automatic one-way filters, drill-down, an advanced rank, display rules and a hidden role.
Data prep is where the report was decided
The raw Discount column is a continuous rate with twelve distinct values. That works in a scatter plot and almost nowhere else. I grouped it into a custom category with four bands: No Discount, Standard 1-20%, Deep 21-40% and Extreme over 40%. That took about five minutes and it ended up carrying the whole report, because once discount is an axis you can put it against anything.
The other derived items were Order Processing Days (Ship Date minus Order Date), a Shipping Speed category built on top of it, and Profit Margin.

Every derived item in one list table: Shipping Speed, Discount Band, Order Processing Days and Profit Margin.
Two things caught me here.
Formats are inherited. Order Processing Days picked up the date format from the two columns it was built from, so a six-day turnaround displayed as a date in 1960. The math was right and the display was nonsense. Switching the format to a plain number fixed it.
A margin has to be an aggregated measure. Profit Margin is Sum[_ByGroup_]('Profit'n) / Sum[_ByGroup_]('Sales'n). If you calculate margin per row and let the tool average it, a $5 order counts the same as a $5,000 one and the number is wrong at every level of the report. SAS also rejects a plain Sum over Sum in the expression editor. It wants to know what to aggregate within, which is what the ByGroup context is for.
Hierarchies and the crosstab
I built a Product Hierarchy (Category, Sub-Category, Product Name) and put it on the rows of a crosstab, with the Discount Band custom category on the columns and the aggregated margin as a measure. So one object uses a hierarchy, a custom category and a calculated measure at once, and the chevrons on the rows drill down without leaving the page.

Hierarchy on the rows, custom category on the columns, aggregated margin in the cells. Every category is profitable at no discount and loses money past 20 percent.
The map that drew fine and was wrong
This was the hardest part of the build. To put State on a map you turn it into a geography item, and SAS asks what kind of names it should look them up against. My first pick was Country or Region Names. The map drew. The legend drew. Nothing reported an error. It had matched about 2 percent of the rows.
The fix was setting the lookup to US State Names. I only caught it because a map of a US-only dataset should not be mostly empty. A visual that renders is not the same thing as a visual that is correct, and SAS will not tell you the difference.

Profit by state after the geography item was fixed, with profit by region underneath.
Picking chart types on purpose
A few choices I would defend:
Butterfly chart for sales against profit by category. Mirrored axes make it obvious that Furniture sells about as much as the other two categories and keeps a fraction of the profit (2.5 percent margin against roughly 17).
Dot plot for margin by sub-category, sorted low to high. Three sub-categories sit below zero and the rest are spread between 2 and 44 percent.
Step plot for average discount by quarter. Discount policy holds at a level and then moves. A line chart would suggest a smooth drift that never happened.
Dual axis time series binned to month. At the default daily grain the same data is 1,237 points and unreadable.

Butterfly chart and dot plot on the comparison page.

Sales and profit by month on a dual axis, and average discount by quarter as a step plot.

Box plot, donut chart, word cloud and dual axis bar chart on the advanced visualization page.
Ranks, filters and interactions
One page is a working demo of the filtering and ranking tools. The Top 10 chart combines an advanced rank with an object filter that keeps only the two deepest discount bands. A common Region filter is shared by all three charts. Clicking a bar in one chart filters the others through automatic one-way filters, and the underlined category labels drill through the product hierarchy.
On the dashboard, the Region and Category controls are page prompts, and the summary text is dynamic. It reads the current selection instead of repeating a number I typed in.

Custom category, advanced rank with an object filter, and a drill-down hierarchy on one page.
What the report found
The short version: profit falls off a cliff at a 20 percent discount. Orders with no discount return a 29.5 percent margin and orders discounted 1 to 20 percent return 11.9 percent. Past 20 percent every band loses money. The 1,393 order lines above that threshold (13.9 percent of all lines) brought in $362,770 of sales and lost $135,376.
Most of the deep discounting sits in four states: Texas, Ohio, Pennsylvania and Illinois. The sub-categories that look unprofitable, Tables and Bookcases, make money when they are not heavily discounted. So the recommendation was a pricing rule, a 20 percent discount cap with manager approval above it, and not a product or territory change.
One caution I kept in the report: these are margins from the same transactions, not the result of a controlled change. Discount depth predicts loss here. That is not proof it causes it.
What I would tell someone starting in SAS Viya
Fix formats at the data source. It is cheaper once there than on every object later.
Check that a visual is right, not just that it rendered. The geography lookup taught me that.
The PDF export is a snapshot. It clips anything that runs past one page and does not render data-driven content at all, so the layout has to be planned for print, not just for the screen.
Let the data change the story. An early draft said revenue was outpacing profit. The data showed profit up 89 percent against sales up 51 percent, so that claim came out.
The report pages and README are on GitHub: github.com/chadwambles/sas-viya-executive-report



Comments