Best Practices: Letting SAS Enterprise Guide Write MDX Code
SAS Enterprise Guide is a VERY useful client tool for SAS development and data analysis. One the best features is the ability to see the SAS code generated from different tasks. In addition to viewing the Base SAS code used to perform different tasks, you can also view MDX code written to create certain measures, members, and sets in OLAP Cubes.
Adding Simple Measures from SAS Enterprise Guide
Let’s start by creating a simple measure for a Rolling 3 Months of Sales using my SGF2011 cube:
Create a time series measure:
Enter the parameters:
Specify the format:
The next screen summarizes the parameters entered into this wizard. You can see the MDX written here as well. Click ‘Finish’ to define the measure.
You should see the measure in your cube output. Right click anywhere on the grid output to ‘Edit View’ > ‘Edit with MDX Editor’.
This is the output you should see in the MDX Editor:
The measure can then be defined in the cube globally by putting the MDX code in the SAS program which builds the cube (if applicable) or through SAS OLAP Cube Studio. This same method can be used to view the MDX code generated for custom members and sets.
On a more general note, if you want to learn MDX, you can use SAS Enterprise Guide to learn basic MDX syntax by manipulating a cube and viewing the MDX code generated. If you need some help getting started with OLAP – in the To Write or not Write OLAP Code post I talk more about writing OLAP cubes.
Never miss a post!
Get the latest BI Notes post in your Inbox when a new post is released! Click here for free subscription. You email address is kept private and you can unsubscribe anytime. Go ahead ... join us!
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 Steve Overton (see all)
- Need to Migrate Users, Groups, and Roles between SAS Environments? - November 5, 2013
- BulkLoading with PostgreSQL available in SAS 9.4 - October 22, 2013
- Update Table Metadata Using Base SAS Code - December 19, 2012
- SAS Administration: Fetch Data Faster across ODBC - November 1, 2012
- SAS Code: Simple Macro to Benchmark Data Performance - August 8, 2012