Tag: MDX

MDX: Dynamically Hiding Measures for Compliance

OLAP cubes are great for summarizing data very fast – I love them .   In certain environments, HIPAA compliance for personally identifiable data might be a concern.  Even at the lowest grain of a cube it might be possible to identify the specific detail data beneath the surface if the summarized number is small enough.  For example, if a report shows the number of people that work for a company in a county of a state that are over the age of 50 – it may be beneficial to hide the statistic to protect the identity of that sample size. Using MDX logic, we can dynamically hide measures that meet a certain criteria.  In the MDX code below, I have added an additional measure to the OLAP cube I used for SAS Global forum in 2011.   It will aggregate the Total Sales measure like normal but if the Total Sales measure is less than 50,000 it will show nothing. DEFINE Member “[SGF2011].[Measures].[Restricted Total Sales]” AS ‘iif([Measures].[Total Sales]<50000,NULL,[Measures].[Total Sales]),FORMAT_STRING = “DOLLAR20.0″‘; The Enterprise Guide screenshot to the right shows the output!     Secure the Original Measure with Metadata Permissions One concept I always promote with writing MDX code is […]

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, […]

SAS OLAP Cubes: Using PROC SQL and MDX to Query OLAP Cubes

SAS PROC SQL has a lot of neat ways you can extract and manipulate data.  In my experience, SAS users typically write PROC SQL to query SAS datasets or relational tables in databases.  You can also…

[[ This is a content summary only. Visit my webs…

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 […]