Creating Multidimensional Data in SAS for Excel Pivot Tables
Chandy Karnum, Ace Analytics Inc., Madison Wis.
4
Here are a few thumb rules:
The granularity of the data or the “grain” of the data has to be defined. The
grain is based on the “fact” that needs to be measured. The “dimension” is
the context within which the facts were generated.
The facts and dimensions are sourced in such a way that there needs to
be one record per numeric measurement described by all the relevant
dimensions of interest.
There needs to be a one to one association between the dimension record
and the fact record. (..is true to grain)
Dimensional hierarchies must be pre-defined by a business process
Creating a multidimensional data involves three steps:
1. Extraction & Transformation: Multidimensional reporting requires
gathering the facts/metrics and their respective groupings/dimensions at
the granular level.
2. Summarization: The granular data then needs to be aggregated to
produce N-dimensional row level data
3. Load: N-dimensional data then has to be loaded as source data into Excel
to create the pivot table as a presentation layer for visualization.
1. Extraction & Transformation:
The initial extraction of data is the most daunting task of the three steps
because you have deal with huge volume of detail transactional /
operational data. This detail data may reside in several databases that
need to be collated to gather the required facts and dimensions. The
DATA step or PROC SQL happens to be robust enough to handle all
these challenges. When certain dimensions needed for the analysis do not
exist we can programmatically derive them by applying the appropriate
business logic that is referred to as a transformation. Here is how a simple
data extraction and transformation step may look like:
PROC FORMAT; *formats to represent sales metrics;
value slsrange
low - <5000 = "$0 to $5,000 "
5000 - <10000 = "$5,001 to $10,000 "
10000 - <100000 = "$10,001 to $100,000"
100000 – high = "$100,000 and above "
OTHER = "Amount not known ";
RUN ;
Data Product_Sales;
Length Country $10;
set sashelp.prdsal2; *source transaction table;
/* Create a Custom Dimension : Region Grouping */
If Country = "U.S.A." and State = "California"
then Region = "USA-West";
else
If Country = "Mexico" and State = "Campeche"