Posts Tagged ‘ SAS Programming ’

Video: New random number generators in SAS

June 15, 2018
By
Video: New random number generators in SAS

My 2018 SAS Global Forum paper was about "how to use the random-number generators (RNGs) in SAS." You can read the paper for details, but I recently recorded a short video that summarizes the main ideas in the paper. In particular, the video gives an overview of the new RNGs [...] The post Video: New random number generators in SAS appeared first on The DO Loop.

Read more »

6 ways to use the _NULL_ data set in SAS

June 11, 2018
By
6 ways to use the _NULL_ data set in SAS

In SAS, the reserved keyword _NULL_ specifies a SAS data set that has no observations and no variables. When you specify _NULL_ as the name of an output data set, the output is not written. The _NULL_ data set is often used when you want to execute DATA step code [...] The post 6 ways to use the _NULL_ data set in SAS appeared first on The DO Loop.

Read more »

6 easy ways to specify a list of variables in SAS

May 29, 2018
By
6 easy ways to specify a list of variables in SAS

The SAS language provides syntax that enables you to quickly specify a list of variables. SAS statements that accept variable lists include the KEEP and DROP statements, the ARRAY statement, and the OF operator for comma-separated arguments to some functions. You can also use variable lists on the VAR statements [...] The post 6 easy ways to specify a list of variables in SAS appeared first on The DO Loop.

Read more »

Position items in a grid

May 21, 2018
By
Position items in a grid

In a recent blog post, Chris Hemedinger used a scatter plot to show the result of 100 coin tosses. Chris arranged the 100 results in a 10 x 10 grid, where the first 10 results were shown on the first row, the second 10 were shown on the second row, and so [...] The post Position items in a grid appeared first on The DO Loop.

Read more »

A macro to execute PROC TTEST for multiple binary grouping variables in SAS (and sorting t-test statistics by their absolute values)

In SAS, you can perform PROC TTEST for multiple numeric variables in the same procedure.  Here is an example using the built-in data set SASHELP.BASEBALL; I will compare the number of at-bats and number of walks between the American League and the National League. proc ttest data = sashelp.baseball; class League; var nAtBat nBB; ods […]

Read more »

A macro to automate the creation of indicator variables in SAS

In a recent blog post, I introduced an easy and efficient way to create indicator variables from categorical variables in SAS.  This method pretends to run logistic regression, but it really is using PROC LOGISTIC to get the design matrix based on dummy-variable coding.  I shared SAS code for how to do so, step-by-step. I […]

Read more »

An easy and efficient way to create indicator variables (a.k.a. dummy variables) from a categorical variable in SAS

Introduction In statistics and biostatistics, the creation of binary indicators is a very useful practice. They can be useful predictor variables in statistical models. They can reduce the amount of memory required to store the data set. They can treat a categorical covariate as a continuous covariate in regression, which has certain mathematical conveniences. However, […]

Read more »

How to use FIRST.variable and LAST.variable in a BY-group analysis in SAS

February 26, 2018
By
How to use FIRST.variable and LAST.variable in a BY-group analysis in SAS

My article about the difference between CLASS variables and BY variables in SAS focused on SAS analytical procedures. However, the BY statement is also useful in the SAS DATA step where it is used to merge data sets and to analyze data at the group level. When you use the [...] The post How to use FIRST.variable and LAST.variable in a BY-group analysis in SAS appeared first on The DO…

Read more »

The difference between CLASS statements and BY statements in SAS

February 14, 2018
By
The difference between CLASS statements and BY statements in SAS

When I first learned to program in SAS, I remember being confused about the difference between CLASS statements and BY statements. A novice SAS programmer recently asked when to use one instead of the other, so this article explains the difference between the CLASS statement and BY variables in SAS [...] The post The difference between CLASS statements and BY statements in SAS appeared first on The DO Loop.

Read more »

How to get the current TITLE in SAS

December 13, 2017
By
How to get the current TITLE in SAS

The SAS language is large. Even after 20+ years of using SAS, there are many features that I have never used. Recently it became necessary for me to learn about DICTIONARY tables in PROC SQL (and the associated SASHELP views) because I needed to programmatically obtain the text for the [...] The post How to get the current TITLE in SAS appeared first on The DO Loop.

Read more »


Subscribe

Email:

  Subscribe