## Programming Tips

Strengthen your programming skills with tips and techniques from the experts

0
Bivariate normal probability in SAS: Rectangular regions

This article shows how to use SAS to compute the probabilities for two correlated normal variables. Specifically, this article shows how to compute the probabilities for rectangular regions in the plane. A second article discusses the computation over infinite regions such as quadrants. If (X,Y) are random variables that are

0
Getting Started with Python Integration to SAS Viya for Predictive Modeling - Creating Training and Validation Data Sets

Learn how to split your data into a training and validation data set to be used for modeling. In part 3 of this series, we replaced the missing values with imputed values. Our final step in preparing the data for modeling is to split the data into a training and

0
An example of finite-precision issues in a simple collinearity algorithm

The collinearity problem is to determine whether three points in the plane lie along a straight line. You can solve this problem by using middle-school algebra. An algebraic solution requires three steps. First, name the points: p, q, and r. Second, find the parametric equation for the line that passes

0
Data visualization tip: Plot rates, not counts

Plot rates, not counts. This maxim is often stated by data visualization experts, but often ignored by practitioners. You might also hear the related phrases "plot proportions" or "plot percentages," which mean the same thing but expresses the idea alliteratively. An example in a previous article about avoiding alphabetical ordering

Programming Tips
0
A tip for moving SAS Visual Analytics reports in SAS Viya 4 between SAS Viya environments

In SAS Viya 4 you can create Reports in SAS Visual Analytics that you may want to move around between machines. What if you want copy a report for example from a development environment folder to a production environment folder? You may want to work on the report in one system before putting it onto a final system and making it generally available. Or you may want to have a backup copy saved for recovery purposes. This blog post provides an updated description of how to easily save off SAS Visual Analytics report content to a file and easily move it between machines.

0
Getting Started with Python Integration to SAS Viya for Predictive Modeling - Imputing Missing Values

In part 1 of this series, we examined our data before building any models. Among the discoveries were missing values in some of our columns. Missing values are an inevitable part of data analysis. Whether it's due to a faulty sensor, human error, or simply the absence of information, missing

0
On resizing an array when an index is out of bounds

Converting a program from one language to another can be a challenge. Even if the languages share many features, there is often syntax that is valid in one language that is not valid in another. Recently, a SAS programmer was converting a program from R to SAS IML. He reached

Programming Tips
0
Extract text from a PDF file using SAS Viya

You most likely have used a Portable Document Format (PDF) file in one form or another. Now, what if you have a PDF file and want to extract the text from the file? What if the PDF file contains input fields that a user fills in and you want to

0
4 ways to display an inset that contains statistics on a SAS graph

Sometimes it is helpful to display a table of statistics directly on a graph. A simple example is displaying the number of observations and the mean or median on a histogram. In SAS, the term inset is used to describe a table that is displayed on a graph. This article

0
파라미터(Parameter)란 무엇인가? – 시리즈 ①

SAS Visual Anaytics(이하, VA)를 사용할 때, 리포트의 형태를 고정하고 변수만 변경하면서 그래프 및 값들이 바뀌는 결과를 확인할 수 있으면 더 효율적이지 않을까 생각해 본 적이 있으신가요? VA에서 파라미터를 활용하면 가능합니다. 파라미터의 활용법을 다루기 전에 전반적인 이해를 돕고자 파라미터가 무엇인지, 어떻게 사용하는 것인지 등에 대한 내용을 먼저 살펴보고자 합니다. 이번 블로그

Programming Tips
0
The SAS® Viya® platform provides multiple methods to append to CAS tables

Appending data tables is a common task for data analysis. Here are three of the several methods possible through the SAS Viya platform.

0
Standard errors for maximum likelihood estimation

In several previous articles, I've shown how to use SAS to fit models to data by using maximum likelihood estimation (MLE). However, I have not previously shown how to obtain standard errors for the estimates. This article combines two previous articles to show how to obtain MLE estimates and the

0
The distribution of the sample median for normal data

A previous article shows how to use Monte Carlo simulation to approximate the sampling distribution of the sample mean and sample median. When x ~ N(0,1) are normal data, the sample mean is also normal, and there are simple formulas for the expected value and the standard error of the

Programming Tips
0
Create User Defined Functions (UDFs) for the CAS Server on SAS Viya

Welcome back to my SAS Users blog series CAS Action! - a series on fundamentals. In this post, I'll show how to create user defined functions (UDFs) for the distributed CAS server using SAS and CASL code. Once the UDF is created, you can use it on the CAS server with programming

0
The distribution of the sample median

An elementary course in statistics often includes a discussion of the sampling distribution of a statistic. The canonical example is the sampling distribution of the sample mean. For samples of size n that are drawn from a normally distribution (X ~ N(μ, σ)), the sample mean is normally distributed as

0
Quantiles of the generalized birthday problem

A previous article discusses the birthday problem and its generalizations. The classic birthday problem asks, "In a room that contains N people, what is the probability that two or more people share a birthday?" The probability is much higher than you might think. For example, in a room that contains

0
How to draw a radar chart in SAS® Visual Analytics using a custom graph – Part II

In the second of a two-part series, SAS' Cindy Wang reveals how to create a custom graph template in SAS Graph Builder that can be rendered as a radar chart in SAS Visual Analytics.

0
The generalized birthday problem

The birthday-matching problem (also called the birthday paradox or simply the birthday problem), is a classic problem in probability. Simply stated, the birthday-matching problem asks, "If there are N people in a room, what is the chance that two of them have the same birthday?" The problem is sometimes called

0
컴퓨터가 사물을 보는 방법, CNN 실습 – 3편

지난 포스팅(컴퓨터가 사물을 보는 방법 1편, 2편)에서는 CNN(Convolution Neural Network)에서 사용될 수 있는 다양한 기법들과 함께 CNN의 학습이 어떤 방식으로 이루어지는지 알아보았습니다. CNN은 데이터(특히 이미지 데이터)에 합성곱, 풀링, 패딩 등의 작업을 거쳐 특징을 추출한 후 회귀 또는 분류를 수행하는 딥러닝 모델입니다. 오늘 포스팅에서는 지금까지 배운 기법들을 SAS Viya에서 구현하는 실습을

0
How to draw a radar chart in SAS® Visual Analytics using a custom graph – Part I

In the first of a two-part series, SAS' Cindy Wang shows you how to create a radar chart in SAS Visual Analytics using custom graph capabilities.

0
On the evaluation of the function exp(x) - 1

Recently I wrote about numerical analysis problem: the accurate computation of log(1+x) when x is close to 0. A naive computation of log(1+x) loses accuracy if you call the LOG function, which is why the SAS language provides the built-in LOG1PX for this computation. In addition, I showed that you

Programming Tips
0
Python Integration to SAS® Viya® - Part 22 - Create User Defined Functions (UDFs)

Welcome to the continuation of my series Getting Started with Python Integration to SAS Viya. In this post I'll show how to create user defined functions (UDFs) for the distributed CAS server using the SWAT package. Once the UDF is created you can use it on the CAS server with programming

0
Approximate functions by using Taylor series and rational functions

SAS supports a special function for the accurate evaluation of log(1+x) when x is near 0. The LOG1PX function is useful because a naive computation of log(1+x) loses accuracy when x is near 0. This article demonstrates two general approximation techniques that are often used in numerical analysis: the Taylor

0
SAS Viya 4의 클라우드 분석 서비스(CAS) 라이프 사이클

SAS는 2020년 1월, LTS 2020.1 버전의 SAS Viya 4를 출시했습니다. SAS Viya 4는 기존 SAS의 솔루션인 SAS 9, SAS Viya 3.5 버전과는 달리 완전한 클라우드 네이티브 버전의 솔루션입니다. 오늘 포스팅에서는 클라우드 네이티브 SAS Viya 4의 서비스인 CAS(Cloud Analytics Service, 이하 CAS)의 라이프 사이클에 대해서 알아보겠습니다. 1. CAS란 무엇일까요? CAS는 고성능

0
Functions for continuous probability distributions in SAS

The documentation for Python's SciPy package provides a table that concisely summarizes functions that are associated with continuous probability distributions. This article provides a similar table for SAS functions. For more information on the CDF, PDF, quantile, and random-variate functions, see "Four essential functions for statistical programmers." SAS functions for

0
Use design matrices to analyze subgroups in SAS IML

A previous article shows ways to perform efficient BY-group processing in the SAS IML language. BY-group processing is a SAS-ism for what other languages call group processing or subgroup processing. The main idea is that the data set contains several discrete variables such as sex, race, education level, and so

Programming Tips
0
Three steps to migrate OS Scheduler SAS Scheduling Jobs from SAS 9 to SAS Viya

Just coming in from an AP news source, here's your situation: At your company, you have both a SAS 9 and a SAS Viya Environment. And your problem: You want to migrate your scheduling jobs which are SAS programs from SAS 9 to a SAS Viya Environment. How can this

Programming Tips
0
Define or extract the diagonals of a matrix

Many useful matrices in applied math and statistics have a banded structure. Examples include diagonal matrices, tridiagonal matrices, banded matrices, and Toeplitz matrices. An example of an unsymmetric Toeplitz matrix is shown to the right. Notice that the matrix is constant along each diagonal, including sub- and superdiagonals. Recently, I

0
Avoid domain errors by using Taylor series

The other day I was trying to numerically integrate the function f(x) = sin(x)/x on the domain [0,∞). The graph of this function is shown to the right. In SAS, you can use the QUAD subroutine in SAS IML software to perform numerical integration. Some numerical integrators have difficulty computing

1 2 3 64