Do loop vs. vectorization in SAS/IML

Vectorization is an important skill for many matrix languages. From Rick Wiklin’s book about SAS/IML and his recent cheat sheet, I found a few new vector-wise functions since SAS 9.22. To compare the computation efficiency between the traditional d…

SAS EG: 3 Quick Tips for Working with Data

In 2002, I started out using BASE SAS 8 and it wasn’t until nearly two years later that I learned how to use SAS Enterprise Guide.  I quickly grew to love it.  It made it so much easier to build charts and just keep my data organized.  Today I just want to share some quick tips that I use SAS Enterprise Guide to review my data quickly. Tip #1  Look at the Dataset Some people don’t realize they can view the dataset in the metadata – just like you can in BASE SAS.  All you have to do it double-click and dataset is added to the Project Tree.  You can then double-click the dataset and view it.  [Not too long I discussed datasets and metadata libraries.] Tip #2: View Unique Values for a Variable You can use PROC FREQ to see all values for a variable but that involves typing.  Sometimes I’m in the middle of a some code so I don’t want to add another program or maybe I’m just too lazy. Select Filter and Sort on your dataset.  In the Filter tab, add the variable you want to view – for instance I needed to know the company […]

Find Errors and Warnings Quickly

Need to find all of the errors and warnings in your SAS Log quickly? Unleash the following while inside the log’s directory while on any *nix based OS. egrep ‘(ERROR:|WARNING)’ I save a lot of time scanning the 10,000+ line log files some of the automated jobs create.

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