Indexing a SAS data set to improve processing categories in SAS/IML
I have blogged about three different SAS/IML techniques that iterate over categories and process the observations in each category. The three techniques are as follows: Use a WHERE clause on the READ...
View ArticleSimulation in SAS: The slow way or the BY way
Over the past few years, and especially since I posted my article on eight tips to make your simulation run faster, I have received many emails (often with attached SAS programs) from SAS users who...
View ArticleEfficient acceptance-rejection simulation: Part II
Last week I wrote about using acceptance-rejection algorithms in vector languages to simulate data. The main point I made is that in a vector language it is efficient to generate many more variates...
View ArticleRemove or keep: Which is faster?
In a recent article on efficient simulation from a truncated distribution, I wrote some SAS/IML code that used the LOC function to find and exclude observations that satisfy some criterion. Some...
View ArticleGenerate binary outcomes with varying probability
A while ago I saw a blog post on how to simulate Bernoulli outcomes when the probability of generating a 1 (success) varies from observation to observation. I've done this often in SAS, both in the...
View ArticleOh, those pesky temporary variables!
The SAS/IML language secretly creates temporary variables. Most of the time programmers aren't even aware that the language does this. However, there is one situation where if you don't think carefully...
View ArticleHow to vectorize computations in a matrix language
Last week someone posted an interesting question to the SAS/IML Support Community. The problem involved four nested DO loops and took hours to run. By transforming several nested DO loops into an...
View ArticleUsing simulation to estimate the power of a statistical test
The power of a statistical test measures the test's ability to detect a specific alternate hypothesis. For example, educational researchers might want to compare the mean scores of boys and girls on a...
View ArticleCount the number of unique rows in a matrix
How do you count the number of unique rows in a matrix? The simplest algorithm is to sort the data and then iterate down the rows, comparing each row with the previous row. However, this algorithm has...
View ArticleFinding observations that match a target value
Imagine that you have one million rows of numerical data and you want to determine if a particular "target" value occurs. How might you find where the value occurs? For univariate data, this is an easy...
View ArticleCompare the performance of algorithms in SAS
As my colleague Margaret Crevar recently wrote, it is useful to know how long SAS programs take to run. Margaret and others have written about how to use the SAS FULLSTIMER option to monitor the...
View Article6 tips for timing the performance of algorithms
This post was kindly contributed by The DO Loop - go there to comment and to read the full post. When you implement a statistical algorithm in a vector-matrix language such as SAS/IML, R, or MATLAB,...
View ArticleRadial basis functions and Gaussian kernels in SAS
This post was kindly contributed by The DO Loop - go there to comment and to read the full post. A radial basis function is a scalar function that depends on the distance to some point, called the...
View ArticleThe intersection of multiple sets
This post was kindly contributed by The DO Loop - go there to comment and to read the full post. This article compares several ways to find the elements that are common to multiple sets. I test which...
View ArticleWrite to a SAS data set from inside a SAS/IML loop
This post was kindly contributed by The DO Loop - go there to comment and to read the full post. In SAS/IML programs, a common task is to write values in a matrix to a SAS data set. For some programs,...
View ArticleShort-circuit evaluation and logical ligatures in SAS
This post was kindly contributed by The DO Loop - go there to comment and to read the full post. Many programmers are familiar with “short-circuit” evaluation in an IF-THEN statement. Short circuit...
View Article
More Pages to Explore .....