Blog Archives

On the number of permutations supported in SAS software

March 25, 2015
By
On the number of permutations supported in SAS software

There's "big," and then there is "factorial big." If you have k items, the number of permutations is "k factorial," which is written as k!. The factorial function gets big fast. For example, the value of k! for several values of k is shown in the following table. You can […] The post On the number of permutations supported in SAS software appeared first on The DO Loop.

Read more »

Vectors that have a fractional number of elements

March 23, 2015
By
Vectors that have a fractional number of elements

The title of this article makes no sense. How can the number of elements (in fact, the number of anything!) not be a whole number? In fact, it can't. However, the title refers to the fact that you might compute a quantity that ought to be an integer, but is […] The post Vectors that have a fractional number of elements appeared first on The DO Loop.

Read more »

Finding observations that match a target value

March 18, 2015
By
Finding 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 problem. In the SAS DATA step you can use a WHERE clause or a […] The post Finding observations that match a target value appeared first on The DO Loop.

Read more »

How to pass parameters to a SAS program

March 16, 2015
By
How to pass parameters to a SAS program

This article show how to run a SAS program in batch mode and send parameters into the program by specifying the parameters when you run SAS from a command line interface. This technique has many uses, one of which is to split a long-running SAS computation into a series of […] The post How to pass parameters to a SAS program appeared first on The DO Loop.

Read more »

Analyzing the first 10 million digits of pi: Randomness within structure

March 12, 2015
By
Analyzing the first 10 million digits of pi: Randomness within structure

Saturday, March 14, 2015, is Pi Day, and this year is a super-special Pi Day! This is your once-in-a-lifetime chance to celebrate the first 10 digits of pi (π) by doing something special on 3/14/15 at 9:26:53. Apologies to my European friends, but Pi Day requires that you represent dates […] The post Analyzing the first 10 million digits of pi: Randomness within structure appeared first on The DO Loop.

Read more »

Matrix multiplication with missing values in SAS

March 11, 2015
By
Matrix multiplication with missing values in SAS

Sometimes I get contacted by SAS/IML programmers who discover that the SAS/IML language does not provide built-in support for multiplication of matrices that have missing values. (SAS/IML does support elementwise operations with missing values.) I usually respond by asking what they are trying to accomplish, because mathematically matrix multiplication with […] The post Matrix multiplication with missing values in SAS appeared first on The DO Loop.

Read more »

Writing data in chunks: Does the chunk size matter?

March 9, 2015
By
Writing data in chunks: Does the chunk size matter?

I often blog about the usefulness of vectorization in the SAS/IML language. A one-sentence summary of vectorization is "execute a small number of statements that each analyze a lot of data." In general, for matrix languages (SAS/IML, MATLAB, R, ...) vectorization is more efficient than the alternative, which is to […] The post Writing data in chunks: Does the chunk size matter? appeared first on The DO Loop.

Read more »

Create a custom PDF and CDF in SAS

March 6, 2015
By
Create a custom PDF and CDF in SAS

In my previous post, I showed how to approximate a cumulative density function (CDF) by evaluating only the probability density function. The technique uses the trapezoidal rule of integration to approximate the CDF from the PDF. For common probability distributions, you can use the CDF function in Base SAS to […] The post Create a custom PDF and CDF in SAS appeared first on The DO Loop.

Read more »

An easy way to approximate a cumulative distribution function

March 4, 2015
By
An easy way to approximate a cumulative distribution function

Evaluating a cumulative distribution function (CDF) can be an expensive operation. Each time you evaluate the CDF for a continuous probability distribution, the software has to perform a numerical integration. (Recall that the CDF at a point x is the integral under the probability density function (PDF) where x is […] The post An easy way to approximate a cumulative distribution function appeared first on The DO Loop.

Read more »

Avoid loops, avoid the APPLY function, vectorize!

March 2, 2015
By
Avoid loops, avoid the APPLY function, vectorize!

Last week I received a message from SAS Technical Support saying that a customer's IML program was running slowly. Could I look at it to see whether it could be improved? What I discovered is a good reminder about the importance of vectorizing user-defined modules. The program in this blog […] The post Avoid loops, avoid the APPLY function, vectorize! appeared first on The DO Loop.

Read more »


Subscribe

Email:

  Subscribe