Blog Archives

Sample with replacement and unequal probability in SAS

February 10, 2016
By
Sample with replacement and unequal probability in SAS

How do you sample with replacement in SAS when the probability of choosing each observation varies? I was asked this question recently. The programmer thought he could use PROC SURVEYSELECT to generate the samples, but he wasn't sure which sampling technique he should use to sample with unequal probability. This […] The post Sample with replacement and unequal probability in SAS appeared first on The DO Loop.

Read more »

Read data into vectors or into a matrix: Which is better?

February 8, 2016
By
Read data into vectors or into a matrix: Which is better?

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.

Read more »

Rolling statistics in SAS/IML

February 3, 2016
By
Rolling statistics in SAS/IML

Last week I showed how to use PROC EXPAND to compute moving averages and other rolling statistics in SAS. Unfortunately, PROC EXPAND is part of SAS/ETS software and not every SAS site has a license for SAS/ETS. For simple moving averages, you can write a DATA step program, as discussed […] The post Rolling statistics in SAS/IML appeared first on The DO Loop.

Read more »

Group processing in SAS: The NOTSORTED option

February 1, 2016
By
Group processing in SAS: The NOTSORTED option

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.

Read more »

Compute a moving average in SAS

January 27, 2016
By
Compute a moving average in SAS

A common question on SAS discussion forums is how to compute a moving average in SAS. This article shows how to use PROC EXPAND and contains links to articles that use the DATA step or macros to compute moving averages in SAS. In a previous post, I explained how to […] The post Compute a moving average in SAS appeared first on The DO Loop.

Read more »

What is a moving average?

January 25, 2016
By
What is a moving average?

A moving average (also called a rolling average) is a statistical 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.

Read more »

Banking to 45 degrees: Aspect ratios for time series plots

January 20, 2016
By
Banking to 45 degrees: Aspect ratios for time series plots

In SAS, the aspect ratio of a graph is the physical height of the graph divided by the physical width. Recently I demonstrated how to set the aspect ratio of graphs in SAS by using the ASPECT= option in PROC SGPLOT or by using the OVERLAYEQUATED statement in the Graph […] The post Banking to 45 degrees: Aspect ratios for time series plots appeared first on The DO Loop.

Read more »

Create a SAS macro variable that contains a list of values

January 18, 2016
By
Create a SAS macro variable that contains a list of values

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.

Read more »

Compute the centroid of a polygon in SAS

January 13, 2016
By
Compute the centroid of a polygon in SAS

Recently I blogged about how to compute a weighted mean and showed that you can use a weighted mean to compute the center of mass for a system of N point masses in the plane. That led me to think about a related problem: computing the center of mass (called […] The post Compute the centroid of a polygon in SAS appeared first on The DO Loop.

Read more »

Twelve posts from 2015 that deserve a second look

January 11, 2016
By
Twelve posts from 2015 that deserve a second look

I began 2016 by compiling a list of popular articles from my blog in 2015. This "People's Choice" list contains many interesting articles, but some of my personal favorites did not make the list. Today I present the "Editor's Choice" list of articles that deserve a second look. I've grouped […] The post Twelve posts from 2015 that deserve a second look appeared first on The DO Loop.

Read more »


Subscribe

Email:

  Subscribe