Quantcast
Channel: Getting Started – PROC-X.com
Viewing all 68 articles
Browse latest View live

The missing value trick for scoring a regression model

$
0
0
A fundamental operation in statistical data analysis is to fit a statistical regression model on one set of data and then evaluate the model on another set of data. The act of evaluating the model on the second set of data is called scoring. One of first "tricks" that I [...]

Techniques for scoring a regression model in SAS

$
0
0
My previous post described how to use the "missing response trick" to score a regression model. As I said in that article, there are other ways to score a regression model. This article describes using the SCORE procedure, a SCORE statement, the relatively new PLM procedure, and the CODE statement. [...]

Aborting a SAS/IML program upon encountering an error

$
0
0
A colleague sent me an interesting question: What is the best way to abort a SAS/IML program? For example, you might want to abort a program if the data is singular or does not contain a sufficient number of observations or variables. As a first attempt would be to try [...]

How to get started with SAS: Free videos for beginners

$
0
0
On most Mondays I blog about a function, programming technique, or resource that is useful for programmers who are getting started with SAS software. Recently I learned that my colleagues in the SAS education division have been hard at work developing a series of short videos that explain basic tasks [...]

Writing data in chunks: Does the chunk size matter?

$
0
0

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.

Sum a series in SAS

$
0
0

A customer asked: Dear Rick, How do we go about summing a finite series in SAS? For example, I want to compute for various integers n ≥ 3. I want to output two columns, one for the natural numbers and one for the summation of the series. Summations arise often […]

The post Sum a series in SAS appeared first on The DO Loop.

An easy way to clear your SAS titles

$
0
0

Did you know that if you have set multiple titles in SAS, that there is an easy way to remove them? For example, suppose that you've written the following statements, which call the TITLE statement to set three titles: title "A Great Big Papa Title"; title2 "A Medium-sized Mama Title"; […]

The post An easy way to clear your SAS titles appeared first on The DO Loop.

Finding observations that satisfy multiple conditions

$
0
0

A common task in data analysis is to locate observations that satisfy multiple criteria. For example, you might want to locate all zip codes in certain counties within specified states. The SAS DATA step contains the powerful WHERE statement, which enables you to extract a subset of data that satisfy […]

The post Finding observations that satisfy multiple conditions appeared first on The DO Loop.


Five reasons to use ODS EXCLUDE to suppress SAS output

$
0
0

I previously wrote about the best way to suppress output from SAS procedures. Suppressing output is necessary in simulation and bootstrap analyses, and it is useful in other contexts as well. In my previous article, I wrote, "many programmers use ODS _ALL_ CLOSE as a way to suppress output, but […]

The post Five reasons to use ODS EXCLUDE to suppress SAS output appeared first on The DO Loop.

SAS/IML functions that operate on columns of a matrix

$
0
0

A SAS programmer asked for a list of SAS/IML functions that operate on the columns of an n x p matrix and return a 1 x p row vector of results. The functions that behave this way tend to compute univariate descriptive statistics such as the mean, median, standard deviation, and quantiles. The following […]

The post SAS/IML functions that operate on columns of a matrix appeared first on The DO Loop.

Everything you wanted to know about writing SAS/IML modules

$
0
0

One of the fundamental principles of computer programming is to break a task into smaller subtasks and to modularize the program by encapsulating each subtask into its own function. I have written many blog posts over the years about how to define and use functions in the SAS/IML language. I […]

The post Everything you wanted to know about writing SAS/IML modules appeared first on The DO Loop.

An easy way to use numbers for column headers

$
0
0

When I am computing with SAS/IML matrices and vectors, I often want to label the columns or rows so that I can better understand the data. The labels are called headers, and the COLNAME= and ROWNAME= options in the SAS/IML PRINT statement enable you to add headers for columns and […]

The post An easy way to use numbers for column headers appeared first on The DO Loop.

Compare the performance of algorithms in SAS

$
0
0

As my colleague Margaret Crevar recently wrote, it is useful to know how long SAS programs take to run. Margaret and others have written about how to use the SAS FULLSTIMER option to monitor the performance of the SAS system. In fact, SAS distributes a macro that enables you to […]

The post Compare the performance of algorithms in SAS appeared first on The DO Loop.

Create a density curve with shaded tails

$
0
0

A SAS programmer wanted to plot the normal distribution and highlight the area under curve that corresponds to the tails of the distribution. For example, the following plot shows the lower decile shaded in blue and the upper decile shaded in red. An easy way to do this in SAS […]

The post Create a density curve with shaded tails appeared first on The DO Loop.

Convert a vector to a string

$
0
0

Base SAS contains many functions for processing strings, and you can call these functions from within a SAS/IML program. However, sometimes a SAS/IML programmer needs to process a vector of strings. No problem! You can call most Base SAS functions with a vector of parameters. I have previously written about […]

The post Convert a vector to a string appeared first on The DO Loop.


Those tricky PERCENT formats

$
0
0

When using SAS to format a number as a percentage, there is a little trick that you need to remember: the width of the formatted value must include room for the decimal point, the percent sign, and the possibility of two parentheses that indicate negative values. The field width must […]

The post Those tricky PERCENT formats appeared first on The DO Loop.

Excluding variables: Read all but one variable into a matrix

$
0
0

Dear Rick, I have a data set with 1,001 numerical variables. One variable is the response, the others are explanatory variable. How can I read the 1,000 explanatory variables into an IML matrix without typing every name? That's a good question. You need to be able to perform two sub-tasks: […]

The post Excluding variables: Read all but one variable into a matrix appeared first on The DO Loop.

Ten “one-liners” that create test matrices for statistical programmers

Tabulate counts when there are unobserved categories

$
0
0

Suppose that you are tabulating the eye colors of students in a small class (following Friendly, 1992). Depending upon the ethnic groups of these students, you might not observe any green-eyed students. How do you put a 0 into the table that summarizes the number of students who have each […]

The post Tabulate counts when there are unobserved categories appeared first on The DO Loop.

Compute a weighted mean in SAS

$
0
0

Weighted averages are all around us. Teachers use weighted averages to assign a test more weight than a quiz. Schools use weighted averages to compute grade-point averages. Financial companies compute the return on a portfolio as a weighted average of the component assets. Financial charts show (linearly) weighted moving averages […]

The post Compute a weighted mean in SAS appeared first on The DO Loop.

Viewing all 68 articles
Browse latest View live




Latest Images