Blog Archives

Lists: Nonmatrix data structures in SAS/IML

March 29, 2017
By
Lists: Nonmatrix data structures in SAS/IML

Lists are collections of objects. SAS/IML 14.2 supports lists as a way to store matrices, data tables, and other lists in a single object that you can pass to functions. SAS/IML lists automatically grow if you add new items to them and shrink if you remove items. You can also [...] The post Lists: Nonmatrix data structures in SAS/IML appeared first on The DO Loop.

Read more »

Is ODS graphics enabled? Use automatic macro variables to determine the state of SAS

March 27, 2017
By
Is ODS graphics enabled? Use automatic macro variables to determine the state of SAS

Did you know that you can check a SAS macro variable to see if ODS graphics is enabled? The other day I wanted to write a SAS program that creates a graph only if ODS graphics is enabled. The solution is to check the SYSODSGRAPHICS macro variable, which is automatically [...] The post Is ODS graphics enabled? Use automatic macro variables to determine the state of SAS appeared first on…

Read more »

Data tables: Nonmatrix data structures in SAS/IML

March 22, 2017
By
Data tables: Nonmatrix data structures in SAS/IML

Prior to SAS/IML 14.2, every variable in the Interactive Matrix Language (IML) represented a matrix. That changed when SAS/IML 14.2 introduced two new data structures: data tables and lists. This article gives an overview of data tables. I will blog about lists in a separate article. A matrix is a [...] The post Data tables: Nonmatrix data structures in SAS/IML appeared first on The DO Loop.

Read more »

Discover information about SAS formats… programmatically

March 20, 2017
By
Discover information about SAS formats… programmatically

SAS formats are very useful and can be used in a myriad of creative ways. For example, you can use formats to display decimal values as a fraction. However, SAS supports so many formats that it is difficult to remember details about the format syntax, such as the default field [...] The post Discover information about SAS formats... programmatically appeared first on The DO Loop.

Read more »

LEAVE and CONTINUE: Two ways to control the flow in a SAS DO loop

March 15, 2017
By
LEAVE and CONTINUE: Two ways to control the flow in a SAS DO loop

SAS programmers who have experience with other programming languages sometimes wonder whether the SAS language supports statements that are equivalent to the "break" and "continue" statements in other languages. The answer is yes. The LEAVE statement in the SAS DATA step is equivalent to the "break" statement. It provides a [...] The post LEAVE and CONTINUE: Two ways to control the flow in a SAS DO loop appeared first on…

Read more »

Find your birthday in the digits of pi

March 13, 2017
By
Find your birthday in the digits of pi

It is time for Pi Day, 2017! Every year on March 14th (written 3/14 in the US), geeky mathematicians and their friends celebrate "all things pi-related" because 3.14 is the three-decimal approximation to pi. This year I use SAS software to show an amazing fact: you can find your birthday [...] The post Find your birthday in the digits of pi appeared first on The DO Loop.

Read more »

Find a pattern in a sequence of digits

March 10, 2017
By
Find a pattern in a sequence of digits

I recently needed to solve a fun programming problem. I challenge other SAS programmers to solve it, too! The problem is easy to state: Given a long sequence of digits, can you write a program to count how many times a particular subsequence occurs? For example, if I give you [...] The post Find a pattern in a sequence of digits appeared first on The DO Loop.

Read more »

Display output conditionally with PROC DOCUMENT

March 8, 2017
By
Display output conditionally with PROC DOCUMENT

Suppose you have several discrete variables. You want to conduct a frequency analysis of these variables and print the results, but ONLY for variables that have three or more levels. In other words, you want to conditionally display some results, but you don't know which variables satisfy the condition until [...] The post Display output conditionally with PROC DOCUMENT appeared first on The DO Loop.

Read more »

Reorder the output from a BY-group analysis in SAS

March 6, 2017
By
Reorder the output from a  BY-group analysis in SAS

After reading my article about how to use BY-group processing to run 1000 regression models, a SAS programmer asked whether it is possible to reorder the output of a BY-group analysis. The answer is yes: you can use the DOCUMENT procedure to replay a portion of your output in any [...] The post Reorder the output from a BY-group analysis in SAS appeared first on The DO Loop.

Read more »

Monte Carlo estimates of joint probabilities

March 1, 2017
By
Monte Carlo estimates of joint probabilities

Monte Carlo techniques have many applications, but a primary application is to approximate the probability that some event occurs. The idea is to simulate data from the population and count the proportion of times that the event occurs in the simulated data. For continuous univariate distributions, the probability of an [...] The post Monte Carlo estimates of joint probabilities appeared first on The DO Loop.

Read more »


Subscribe

Email:

  Subscribe