Strengthen your programming skills with tips and techniques from the experts

SAS' Leonid Batkhan explores shell scripting as an alternative way to implement parallel processing.

Strengthen your programming skills with tips and techniques from the experts

Using shell scripts for massively parallel processing

SAS' Leonid Batkhan explores shell scripting as an alternative way to implement parallel processing.

SAS graphs for R programmers - pie charts

This is another in my series of blog posts where I take a deep dive into converting R graphs into SAS graphs. Today we'll be working on pie charts. I know, I know ... you visualization 'purists' might be wagging your finger at me, and saying "pie charts are no good."

Double integrals by using Monte Carlo methods

As mentioned in my article about Monte Carlo estimate of (one-dimensional) integrals, one of the advantages of Monte Carlo integration is that you can perform multivariate integrals on complicated regions. This article demonstrates how to use SAS to obtain a Monte Carlo estimate of a double integral over rectangular and

Sample size for the Monte Carlo estimate of an integral

A previous article shows how to use Monte Carlo simulation to estimate a one-dimensional integral on a finite interval. A larger random sample will (on average) result in an estimate that is closer to the true value of the integral than a smaller sample. This article shows how you can

To be and not to be – the uncertainty principle in SAS

If I were to say that we live in uncertain times, that would probably be an understatement. Therefore, I won’t say that. Oops, I already did. Or did I? For centuries, people around the world have been busy scratching their heads in search of a meaningful answer to Shakespeare’s profoundly

Estimate an integral by using Monte Carlo simulation

Numerical integration is important in many areas of applied mathematics and statistics. For one-dimensional integrals on the interval (a, b), SAS software provides two important tools for numerical integration: For common univariate probability distributions, you can use the CDF function to integrate the density, thus obtaining the probability that a

Programmatically export a Visual Analytics report to PDF

Readers of my earlier post Discover Visual Analytics Report Paths with REST APIs asked for ways to export SAS Visual Analytics (VA) report content programmatically. I know this is a topic of interest from many VA report designers. So, I think it’s better to write something on this and I

How to conditionally stop SAS code execution and gracefully terminate SAS session

SAS' Leonid Batkhan reveals a fuss-free way to halt SAS program execution and terminate SAS session in batch-processing scenarios.

Get to know the List Table

The List Table can be more than just a black-and-white ledger style visual. There are many other enhancements such as alternating row colors, abbreviated values, display rules, etc.

Control the fill and outline colors of scatter plot markers in SAS

This article shows how to use PROC SGPLOT in SAS to create the scatter plot shown to the right. The scatter plot has the following features: The colors of markers are determined by the value of a third variable. The outline of each marker is the same color (such as

How to conditionally execute SAS global statements

SAS' Leonid Batkhan reveals coding techniques that give you control of when and whether global statements are executed.

SAS graphs for R programmers - bar charts

This is another in my series of blog posts where I take a deep dive into converting customized R graphs into SAS graphs. Today we'll be working on bar charts ... And to give you a hint about what data I'll be using this time, here's a picture from a SAS

The generalized gamma distribution

A SAS customer wanted to compute the cumulative distribution function (CDF) of the generalized gamma distribution. For any continuous distribution, the CDF is the integral of the probability density function (PDF), which usually has an explicit formula. Accordingly, he wanted to compute the CDF by using the QUAD function in

Tips for working with date, time, and datetime values in DS2

Date and time values are handled differently when programming in DS2. It can process databases and has access to ANSI data types, which have greater precision.

Pi and products

This is my Pi Day post for 2021. 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. Most years I write about lower-case pi (π), which is the ratio of a circle's

SAS graphs for R programmers - maps from shapefiles

This is another in my series of blog posts where I take a deep dive into converting customized R graphs into SAS graphs. Today we'll be working on shapefile maps ... And what data will we be using this time? Here's a hint - the picture below is the Aurora

Convert decimals to fractions in SAS

I have previously shown how you can use the FRACTw. format in SAS to display numbers as fractions. But did you know that you can also use the format to obtain the numerator and denominator of the fraction as numbers in a program? All you need to do is to

Viewing files, programs, and data sets in SAS Studio

The more I use SAS Studio in the cloud via SAS OnDemand for Academics, the more I like it. To demonstrate how useful the Files tab is, I'm going to show you what happens when you drag a text file, a SAS data set, and a SAS program into the

Create a wind chill chart in SAS

I recently wrote about a simple statistical formula that approximates the wind chill temperature, which is the cumulative effect of air temperature and wind on the human body. The formula uses two independent variables (air temperature and wind speed) to predict the wind chill temperature. This article describes how to

SAS graphs for R programmers - bubble maps

This is another in my series of blog posts where I take a deep dive into converting customized R graphs into SAS graphs. Today we'll be working on bubble maps - specifically, plotting earthquake data as bubbles on a map. R bubble map, created using geom_polygon() and geom_point() SAS bubble

The wind chill chart

In cold and blustery conditions, the weather forecast often includes two temperatures: the actual air temperature and the wind chill temperature. The wind chill temperature conveys the cumulative effect of air temperature and wind on the human body. The goal of the wind-chill scale is to communicate the effect of

SAS graphs for R programmers - paneled graphs

This is another in my series of blogs where I take a deep dive into converting customized R graphs into SAS graphs. Today I show how to combine several graphs with shared axes, which we'll call paneled graphs. This time I'll be plotting the Job Openings Rate by Industry, similar

Deleting a substring from a SAS string

SAS' Leonid Batkhan shows you how to delete a substring from a character string - one of the common character data manipulation tasks.

How to use the #BYVAR and #BYVAL keywords to customize graph titles in SAS

A previous article describes how to use the SGPANEL procedure to visualize subgroups of data. It focuses on using headers to display information about each graph. In the example, the data are time series for the price of several stocks, and the headers include information about whether the stock price

Turning external files into SAS® data sets: common problems and their solutions

Amber Elam of SAS Technical Support reveals common challenges and solutions when you convert external files into SAS data sets.

Inserting a substring into a SAS string

SAS' Leonid Batkhan demonstrates a common character data manipulation task of inserting a substring into a character string.

SAS graphs for R programmers - diverging bars

This is another in my series of blogs where I take a deep dive into converting a customized R graph into a SAS graph. Today I'm focusing on a diverging bar chart (where one bar segment is above the zero line, and the other is below). What type of data

Generate all quadratic interactions in a regression model

I've previously written about how to generate all pairwise interactions for a regression model in SAS. For a model that contains continuous effects, the easiest way is to use the EFFECT statement in PROC GLMSELECT to generate second-degree "polynomial effects." However, a SAS programmer was running a simulation study and

Print the top rows of your SAS data

One of the first things I learned in SAS was how to use PROC PRINT to display parts of a data set. I usually do not need to see all the data, so my favorite way to use PROC PRINT is to use the OBS= data set option to display

SAS graphs for R programmers - U.S. choropleth map

This is another in my series of blogs where I take a deep dive into converting a customized R graph into a SAS ODS Graphics graph. Can you guess what data I'll be using this time? Here's a photo with a hint. This is Keeler, California (just west of Death