Tag: SAS Programming

Rick Wicklin 0
Arrange matrices and graphs in a gridded layout

Last week my colleague Chris Hemedinger published a blog post that described how to use the ODS LAYOUT GRIDDED statement to arrange tables and graphs in a panel. The statement was introduced in SAS 9.4m1 (December 2013). Gridded layout is supported for HTML, POWERPOINT, and the PRINTER family of destinations

Rick Wicklin 0
Generate evenly spaced points in an interval

I've previously written about how to generate a sequence of evenly spaced points in an interval. Evenly spaced data is useful for scoring a regression model on an interval. In the previous articles the endpoints of the interval were hard-coded. However, it is common to want to evaluate a function

Susan Slaughter 0
Exercises for Learning SAS Programming

Our new book, Exercises and Projects for The Little SAS® Book Fifth Edition, includes a variety of exercises to help people learn SAS programming. Rebecca Ottesen, Lora Delwiche and I designed this book so that it can be used either in a classroom setting or by individual readers working alone.

Rick Wicklin 0
Large matrices in SAS/IML

Last week, SAS released the 14.1 version of its analytics products, which are shipped as part of the third maintenance release of 9.4. If you run SAS/IML programs from a 64-bit Windows PC, you might be interested to know that you can now create matrices with about 231 ≈ 2

Rick Wicklin 0
Computing polar angles from coordinate data

Equations that involve trigonometric functions can have infinitely many solutions. For example, the solution to the equation tan(θ)=1 is θ = π/4 + kπ, where k is any integer. In order to obtain a unique solution to the equation, we define the "arc" functions: inverse trigonometric functions that return a

Learn SAS
Jim Simon 0
DATA STEP text file tricks

When reading a text file (common extensions: TXT, DAT; or, for the adventurous: HTML) with the DATA STEP, you should always view several lines from the text file, and compare to the record layout, before completing the INPUT statement.  There are many ways to view a text file.  I use

Learn SAS
Jim Simon 0
Dataset too big for PROC PRINT?

Dataset too big for PROC PRINT? One weird trick solves your problem! proc print data=bigdata (obs=10); run; The OBS= dataset option specifies the last observation to process from an input dataset. In the above example, regardless of dataset size, only the first 10 observations are printed; an easy way to

Sian Roberts 0
Get real clinical data

Many of our authors often ask us where they can find real data that they can use without copyright or other confidentiality issues. Instructors too are always on the look-out for real-life data. Well, thanks to a new initiative supported by SAS, you can now access data from more than

Rick Wicklin 0
How to pass parameters to a SAS program

This article show how to run a SAS program in batch mode and send parameters into the program by specifying the parameters when you run SAS from a command line interface. This technique has many uses, one of which is to split a long-running SAS computation into a series of

Rick Wicklin 0
Convert hexadecimal colors to RGB

In response to my recent post about how to use the PALETTE function in SAS/IML to generate color ramps, a reader wrote the following: The PALETTE function returns an array of hexadecimal values such as CXF03B20. For those of us who think about colors as RGB values, is there an

Rick Wicklin 0
Order variables by values of a statistic

When I create a graph of data that contains a categorical variable, I rarely want to display the categories in alphabetical order. For example, the box plot to the left is a plot of 10 standardized variables where the variables are ordered by their median value. The ordering makes it

1 7 8 9 10 11 14