## More Channels

## Showcase

- RSS Channel Showcase 4920275
- RSS Channel Showcase 4912298
- RSS Channel Showcase 4458876
- RSS Channel Showcase 9463192

## Articles on this Page

- 01/18/16--02:21: _Create a SAS macro ...
- 01/25/16--02:22: _What is a moving av...
- 02/01/16--02:24: _Group processing in...
- 02/08/16--02:24: _Read data into vect...
- 02/22/16--02:25: _Create dummy variab...
- 03/28/16--02:27: _Save descriptive st...
- 05/04/16--02:30: _Create a package in...
- 05/23/16--02:26: _How to fit a variet...
- 05/31/16--02:28: _Grids and linear su...
- 06/20/16--02:29: _The SELECT statemen...
- 07/11/16--02:27: _Break a sentence in...
- 07/20/16--02:22: _Do you write unnece...
- 07/25/16--02:27: _Statistical model b...
- 08/08/16--02:22: _Use SAS formats to ...
- 12/19/16--03:31: _Solve linear progra...
- 01/09/17--02:28: _ODS OUTPUT: Store a...
- 02/13/17--02:25: _An easy way to run ...
- 03/15/17--02:22: _LEAVE and CONTINUE:...
- 04/10/17--02:20: _A simple trick to c...
- 06/07/17--02:29: _The IFN function ve...

## Channel Description:

Parameters in SAS procedures are specified a list of values that you manually type into the procedure syntax. For example, if you want to specify a list of percentile values in PROC UNIVARIATE, you need to type the values into the PCTLPTS= option as follows: proc univariate data=sashelp.cars noprint; var […]

The post Create a SAS macro variable that contains a list of values appeared first on The DO Loop.

A moving average (also called a rolling average) is a satistical technique that is used to smooth a time series. Moving averages are used in finance, economics, and quality control. You can overlay a moving average curve on a time series to visualize how each value compares to a rolling […]

The post What is a moving average? appeared first on The DO Loop.

Novice SAS programmers quickly learn the advantages of using PROC SORT to sort data, followed by a BY-group analysis of the sorted data. A typical example is to analyze demographic data by state or by ZIP code. A BY statement enables you to produce multiple analyses from a single procedure […]

The post Group processing in SAS: The NOTSORTED option appeared first on The DO Loop.

In the SAS/IML language, you can read data from a SAS data set into a set of vectors (each with their own name) or into a single matrix. Beginning programmers might wonder about the advantages of each approach. When should you read data into vectors? When should you read data […]

The post Read data into vectors or into a matrix: Which is better? appeared first on The DO Loop.

A dummy variable (also known as indicator variable) is a numeric variable that indicates the presence or absence of some level of a categorical variable. The word "dummy" does not imply that these variables are not smart. Rather, dummy variables serve as a substitute or a proxy for a categorical […]

The post Create dummy variables in SAS appeared first on The DO Loop.

Descriptive univariate statistics are the foundation of data analysis. Before you create a statistical model for new data, you should examine descriptive univariate statistics such as the mean, standard deviation, quantiles, and the number of nonmissing observations. In SAS, there is an easy way to create a data set that […]

The post Save descriptive statistics for multiple variables in a SAS data set appeared first on The DO Loop.

In a previous post I showed how to download, install, and use packages in SAS/IML 14.1. SAS/IML packages incorporate source files, documentation, data sets, and sample programs into a ZIP file. The PACKAGE statement enables you to install, uninstall, and manage packages. You can load functions and data into your […]

The post Create a package in SAS/IML appeared first on The DO Loop.

SAS software can fit many different kinds of regression models. In fact a common question on the SAS Support Communities is "how do I fit a <name> regression model in SAS?" And within that category, the most frequent questions involve how to fit various logistic regression models in SAS. There […]

The post How to fit a variety of logistic regression models in SAS appeared first on The DO Loop.

A grid is a set of evenly spaced points. You can use SAS to create a grid of points on an interval, in a rectangular region in the plane, or even in higher-dimensional regions like the parallelepiped shown at the left, which is generated by three vectors. You can use […]

The post Grids and linear subspaces appeared first on The DO Loop.

Every beginning SAS programmer learns the simple IF-THEN/ELSE statement for conditional processing in the SAS DATA step. The basic If-THEN statement handles two cases: if a condition is true, the program does one thing, otherwise the program does something else. Of course, you can handle more cases by using multiple […]

The post The SELECT statement in the SAS DATA step appeared first on The DO Loop.

Two of my favorite string-manipulation functions in the SAS DATA step are the COUNTW function and the SCAN function. The COUNTW function counts the number of words in a long string of text. Here "word" means a substring that is delimited by special characters, such as a space character, a […]

The post Break a sentence into words in SAS appeared first on The DO Loop.

I'm addicted to you. You're a hard habit to break. Such a hard habit to break. — Chicago, "Hard Habit To Break" Habits are hard to break. For more than 20 years I've been putting semicolons at the end of programming statements in SAS, C/C++, and Java/Javascript. But lately I've been […]

The post Do you write unnecessary SAS statements? appeared first on The DO Loop.

Last week I read an interesting paper by Bob Rodriguez: "Statistical Model Building for Large, Complex Data: Five New Directions in SAS/STAT Software." In it, Rodriguez summarizes five modern techniques for building predictive models and highlights recent SAS/STAT procedures that implement those techniques. The paper discusses the following high-performance (HP) […]

The post Statistical model building and the SELECT procedures in SAS appeared first on The DO Loop.

SAS formats are flexible, dynamic, and have many uses. For example, you can use formats to count missing values and to change the order of a categorical variable in a table or plot. Did you know that you can also use SAS formats to bin a numerical variable into categories? […]

The post Use SAS formats to bin numerical variables appeared first on The DO Loop.

In some applications, you need to optimize a linear objective function of many variables, subject to linear constraints. Solving this problem is called linear programming or linear optimization. This article shows two ways to solve linear programming problems in SAS: You can use the OPTMODEL procedure in SAS/OR software or […]

The post Solve linear programming problems in SAS appeared first on The DO Loop.

In the beginning SAS created procedures and output. The output was formless and void. Then SAS said, "Let there be ODS," and there was ODS. Customers saw that ODS was good, and SAS separated the computation from the display and management of output. The preceding paragraph oversimplifies the SAS Output […]

The post ODS OUTPUT: Store any statistic created by any SAS procedure appeared first on The DO Loop.

A common question on SAS discussion forums is how to repeat an analysis multiple times. Most programmers know that the most efficient way to analyze one model across many subsets of the data (perhaps each country or each state) is to sort the data and use a BY statement to […]

The post An easy way to run thousands of regressions in SAS appeared first on The 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 The DO Loop.

Many intervals in statistics have the form p ± δ, where p is a point estimate and δ is the radius (or half-width) of the interval. (For example, many two-sided confidence intervals have this form, where δ is proportional to the standard error.) Many years ago I wrote an article [...]

The post A simple trick to construct symmetric intervals appeared first on The DO Loop.

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.