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

Administration: Cleaning Up the WORK Library Automatically in UNIX

Here is a quick tip for keeping the WORK library clean in a UNIX/Linux environment.  Most of the time SAS manages the cleanup process very well but sometimes orphaned processes can leave unwanted data lying around which can build up over time.  This tip is only applicable for UNIX or Linux environments.  Windows would have a similar approach with different commands.   Use a Shell Script for UNIX Heavy Lifting This simple shell script will find all WORK directories created by SAS sessions and recursively remove everything within each directory older than a set time frame.  The joys of shell scripting!  WORK=/sas/work#!/bin/sh find $WORK/ -mtime +3 -type f -exec rm -rf {} \; exit 0 The WORK variable is set to the physical path of the WORK library on the compute server.  The number 3 represents the number of days since the file was last modified.  When this script is run, it initiates the find command which finds everything starting from the set directory with a last modified date older than 3 days, then forcibly removes everything within.  To prevent any permission problems, it should be run as ‘root’ or any other super user.  Why Not Schedule It? This shell […]