OLAP Cube Studio: Looking at PROC OLAP Code
If you have never worked with OLAP code – then you might be curious how it works and what it looks like. Some developers use SAS OLAP Cube Studio to start their cube building process since it saves some of the typing required. Let’s review some of the code. [Adv Users: check out Steve’s posts about OLAP Code]
Exporting PROC OLAP Code
There are two methods to export your cube to a SAS program from SAS OLAP Cube Studio.
- Use Method 1 after you have added custom measurements. Click cube name > Export Code. The Export Code window appears.
- Use Method 2 after you have completed the Cube Designer wizard. Click the Export Code button. The Export Code window appears.
From the Export Code window you can select if you want standard (long) OLAP procedure code or the shorten code. Either way – just add the path and program name. [More at SAS Support about when to use short/long form. ]
Under the Hood
After opening the BUILD_GA_BLOGSITE.sas program in Enterprise Guide, you see how the OLAP procedure code appears. You can learn to code your own cubes, just by reviewing how the OLAP wizard wrote the code. For instance, this shows how the Segmentation Dimension appears in OLAP Cube Designer and how the code looks.
There is a Dimension > Hierarchy > Levels. You can see code has a statement for each of those and indicates the members – just as shown in the GUI.
Here’s how the Measure statement looks. You can see how the default measure is declared. Also I highlighted where the BouncesSum and BouncesAvg measures are defined. [Learn more about writing PROC OLAP in SAS 9.2.]
In this example, the MDX code was created by using select cube name > Maintain > Calculated Members. This callout shows how the MDX looks. To learn more about writing MDX code, see these entries or refer to the SAS 9.2 OLAP Server: MDX User Guide. Also check out Steve’s post about Letting SAS EG write your MDX code.
Learn all about SAS BI
You can learn more about SAS Business Intelligence from the "SAS BI Bible." Take a peek inside the Building Business Intelligience with SAS book.
Attending SESUG 2015?
If you are planning to attend SESUG 2015 in beautiful Savannah, Georgia on Sept 29 then join me for my talk about data visualization "How to be the MacGyver of Data Visualization"! I'll show you some cool ways to visualize data with SAS Visual Analytics as well as some traps to avoid.
Latest posts by Tricia Aanderud (see all)
- SAS Visual Analytics: Get to the Point with a Geo Coordinate Map - August 30, 2015
- SAS VA: Is Location just a Distracting Character in Your Dataviz? - August 24, 2015
- Do You KISS Your Line Charts? - August 5, 2015
- How Not Knowing Pie Charts Makes You a #DataViz Rookie - May 7, 2015
- 6 Tips for Data Visualization from a Floral Designer - March 26, 2015