Blog Archives

The IFN function versus the IF-THEN/ELSE statement in SAS

June 7, 2017
By
The IFN function versus the IF-THEN/ELSE statement in SAS

I have previously discussed how to define functions that safely evaluate their arguments and return a missing value if the argument is not in the domain of the function. The canonical example is the LOG function, which is defined only for positive arguments. For example, to evaluate the LOG function [...] The post The IFN function versus the IF-THEN/ELSE statement in SAS appeared first on The DO Loop.

Read more »

Runs in coin tosses; patterns in random seating

June 5, 2017
By
Runs in coin tosses; patterns in random seating

If you toss a coin 28 times, you would not be surprised to see three heads in a row, such as ...THHHTH.... But what about eight heads in a row? Would a sequence such as THHHHHHHHTH... be a rare event? This question popped into my head last weekend as I [...] The post Runs in coin tosses; patterns in random seating appeared first on The DO Loop.

Read more »

How to choose a seed for generating random numbers in SAS

June 1, 2017
By
How to choose a seed for generating random numbers in SAS

Last week I was asked a simple question: "How do I choose a seed for the random number functions in SAS?" The answer might surprise you: use any seed you like. Each seed of a well-designed random number generator is likely to give rise to a stream of random numbers, [...] The post How to choose a seed for generating random numbers in SAS appeared first on The DO Loop.

Read more »

On the SMOOTHCONNECT option in the SERIES statement

May 30, 2017
By
On the SMOOTHCONNECT option in the SERIES statement

By default, when you use the SERIES statement in PROC SGPLOT to create a line plot, the observations are connected (in order) by straight line segments. However, SAS 9.4m1 introduced the SMOOTHCONNECT option which, as the name implies, uses a smooth curve to connect the observations. In Sanjay Matange's blog, [...] The post On the SMOOTHCONNECT option in the SERIES statement appeared first on The DO Loop.

Read more »

Sample quantiles: A comparison of 9 definitions

May 24, 2017
By
Sample quantiles: A comparison of 9 definitions

According to Hyndman and Fan ("Sample Quantiles in Statistical Packages," TAS, 1996), there are nine definitions of sample quantiles that commonly appear in statistical software packages. Hyndman and Fan identify three definitions that are based on rounding and six methods that are based on linear interpolation. This blog post shows [...] The post Sample quantiles: A comparison of 9 definitions appeared first on The DO Loop.

Read more »

Quantile definitions in SAS

May 22, 2017
By
Quantile definitions in SAS

In last week's article about the Flint water crisis, I computed the 90th percentile of a small data set. Although I didn't mention it, the value that I reported is different from the the 90th percentile that is reported in Significance magazine. That is not unusual. The data only had [...] The post Quantile definitions in SAS appeared first on The DO Loop.

Read more »

Quantiles and the Flint water crisis

May 17, 2017
By
Quantiles and the Flint water crisis

The April 2017 issue of Significance magazine features a cover story by Robert Langkjaer-Bain about the Flint (Michigan) water crisis. For those who don't know, the Flint water crisis started in 2014 when the impoverished city began using the Flint River as a source of city water. The water was [...] The post Quantiles and the Flint water crisis appeared first on The DO Loop.

Read more »

INTCK and INTNX: Two essential functions for computing intervals between dates in SAS

May 15, 2017
By
INTCK and INTNX: Two essential functions for computing intervals between dates in SAS

Last week I showed a timeline of living US presidents. The number of living presidents is constant during the time interval between inaugurations and deaths of presidents. The data was taken from a Wikipedia table (shown below) that shows the number of years and days between events. This article shows [...] The post INTCK and INTNX: Two essential functions for computing intervals between dates in SAS appeared first on The…

Read more »

Simulate lognormal data in SAS

May 10, 2017
By
Simulate lognormal data in SAS

A SAS customer asked how to simulate data from a three-parameter lognormal distribution as specified in the PROC UNIVARIATE documentation. In particular, he wanted to incorporate a threshold parameter into the simulation. Simulating lognormal data is easy if you remember an important fact: if X is lognormally distributed, then Y=log(X) [...] The post Simulate lognormal data in SAS appeared first on The DO Loop.

Read more »

Timeline of living US presidents

May 8, 2017
By
Timeline of living US presidents

Quick! What is the next term in the numerical sequence 1, 2, 1, 2, 3, 4, 5, 4, 3, 4, ...? If you said '3', then you must be an American history expert, because that sequence represents the number of living US presidents beginning with Washington's inauguration on 30APR1789 and [...] The post Timeline of living US presidents appeared first on The DO Loop.

Read more »


Subscribe

Email:

  Subscribe