In a previous blog post, I presented a short SAS/IML function module that implements the trapezoidal rule. The trapezoidal rule is a numerical integration scheme that gives the integral of a piecewise linear function that passes through a given set of points. This article demonstrates an application of using the
Uncategorized
In a previous article I discussed the situation where you have a sequence of (x,y) points and you want to find the area under the curve that is defined by those points. I pointed out that usually you need to use statistical modeling before it makes sense to compute the
As organizations confront the limits of forecasting, they finally realize the folly in a blind pursuit of unachievable levels of forecast accuracy. The best accuracy we can ever hope to achieve is limited by the nature -- the forecastability -- of what we are trying to forecast. Anything better than
The other day I was asked, "Given a set of points, what is the area under the curve defined by those points?" As stated, the problem is not well defined. The problem is that "the curve defined by those points" doesn't have a precise meaning. However, after gathering more information,
SAS Enterprise Guide has about 150 options that you can customize in the Tools->Options window. With each release, the development team adds a few more options that have been asked for by customers, and they rarely decommission any existing options. It's getting quite crowded on some of those options windows!
Recently I had to compute the trace of a product of square matrices. That is, I had two large nxn matrices, A and B, and I needed to compute the quantity trace(A*B). Furthermore, I was going to compute this quantity thousands of times for various A and B as part
Did you know that you can display a list of all the SAS/IML variables (matrices) that are defined in the current session? The SHOW statement performs this useful task. For example, the following statements define three matrices: proc iml; fruit = {"apple", "banana", "pear"}; k = 1:3; x = j(1E5,
Have you ever wanted to look like George Clooney and get all the money, fame, and dates? I have long aspired to this. But in the great poker hand of life, I wasn't dealt an inside straight or even a nice pair. So I make do with what I've got.
As I write my first blog entry for SAS State and Local Government, I thought it would be prudent to provide a little personal background. I grew up in a family of artists- with 5 musicians, 2 painters, 1 sculptor, 1 dancer, and 1 composer. I studied business, became a
Many people know that the SGPLOT procedure in SAS 9.2 can create a large number of interesting graphs. Some people also know how to create a panel of graphs (all of the same type) by using the SGPANEL procedure. But did you know that you can also create a panel
I hope that the following statement is not too controversial...but here it goes: Microsoft Excel is not a database system. That is, I know that people do use it as a database, but it's not an application that supports the rigor and discipline of managing data in the same way
This article shows how to randomly access data in a SAS data set by using the READ POINT statement in SAS/IML software. I have previously discussed how to use the READ NEXT and READ CURRENT statements to sequentially access each observation in a SAS data set from PROC IML. Reading
Andrew Ratcliffe posted a fine article titled "Inadequate Mends" in which he extols the benefits of including the name of a macro on the %MEND statement. That is, if you create a macro function named foo, he recommends that you include the name in two places: %macro foo(x); /** define
A fundamental operation in data analysis is finding data that satisfy some criterion. How many people are older than 85? What are the phone numbers of the voters who are registered Democrats? These questions are examples of locating data with certain properties or characteristics. The SAS DATA step has a
For years I've been making presentations about SAS/IML software at conferences. Since 2008, I've always mentioned to SAS customers that they can call R from within SAS/IML software. (This feature was introduced in SAS/IML Studio 3.2 and was added to the IML procedure in SAS/IML 9.22.) I also included a
When Charlie H. posted an interesting article titled "Top 10 most powerful functions for PROC SQL," there was one item on his list that was unfamiliar: the COALESCE function. (Edit: Charlie's blog no longer exists. The article used to be available at http://www.sasanalysis.com/2011/01/top-10-most-powerful-functions-for-proc.html) Ever since I posted my first response,
Last week the Flowing Data blog published an excellent visualization of the flight patterns of major US airlines. On Friday, I sent the link to Robert Allison, my partner in the 2009 ASA Data Expo, which explored airline data. Robert had written a SAS program for the Expo that plots
It's a simple task to use SAS to compute the number of weekdays between two dates. You can use the INTCK function with the WEEKDAY interval to come up with that number. diff = intck('WEEKDAY', start_date, end_date); If you want to compute the number of working days between two dates,
When I was at the annual SAS Global Forum conference, I had the pleasure of discussing statistical programming and SAS/IML software with dozens of SAS customers. I was asked at least ten times, "How do I get started with SAS/IML software?" or "How can I learn PROC IML?" Here is
This blog post shows how to numerically integrate a one-dimensional function by using the QUAD subroutine in SAS/IML software. The name "quad" is short for quadrature, which means numerical integration. You can use the QUAD subroutine to numerically find the definite integral of a function on a finite, semi-infinite, or
More than a month ago I wrote a first article in response to an interesting article by Charlie H. titled Top 10 most powerful functions for PROC SQL. In that article I described SAS/IML equivalents to the MONOTONIC, COUNT, N, FREQ, and NMISS Functions in PROC SQL. In this article,
The Spring 2011 issue of Foresight is now available. Here is Editor Len Tashman's preview: For forecasters, “being wrong” is the expectation; the hope is that we’re not too wrong. But admitting to our failures is never easy. The Spring 2011 issue leads off with Marcus O’Connor’s book review of
SAS Enterprise Guide is best known as an interactive interface to SAS, but did you know that you can use it to run batch-style programs as well? SAS Enterprise Guide has always offered an automation object model, which allows you to use scripting languages (such as VBScript or Windows PowerShell)
The most common way to read observations from a SAS data set into SAS/IML matrices is to read all of the data at once by using the ALL clause in the READ statement. However, the READ statement also has options that do not require holding all of the observations in
Congratulations to Curt Hinrichs and Chuck Boiler! Their book, JMP Essentials: An Illustrated Step-by-Step Guide for New Users, has won an Award of Distinguished Technical Communication in this year’s International Summit Awards presented by the Society for Technical Communication. The award goes to a project that “applies the principles of
In last week's article on how to create a funnel plot in SAS, I wrote the following comment: I have not adjusted the control limits for multiple comparisons. I am doing nine comparisons of individual means to the overall mean, but the limits are based on the assumption that I'm
Greg Nelson and Neil Howard presented a lunchtime keynote talk at SAS Global Forum, and they produced this video, "Revenge of the Semi-Colon People", to go along with it. The video features many people from the SAS community, including customers and SAS employees. Watch it and see if you know
The log transformation is one of the most useful transformations in data analysis. It is used as a transformation to normality and as a variance stabilizing transformation. A log transformation is often used as part of exploratory data analysis in order to visualize (and later model) data that ranges over
I've been walking around the last few days with what looks like a dollop of chocolate syrup or grape jelly on my chin. Alas, it is just a bruise from getting elbowed in the mouth at basketball last Thursday night. (Church leagues may be the only dirtier place to play
One of the advantages of programming in the SAS/IML language is its ability to transform data vectors with a single statement. For example, in data analysis, the log and square-root functions are often used to transform data so that the transformed data have approximate normality. The following SAS/IML statements create