O'Reilly logo

SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating One-Dimensional Arrays

Understanding SAS Arrays

A SAS array is a temporary grouping of SAS variables under a single name. An array exists only for the duration of the DATA step.
SAS Array Variables
One reason for using an array is to reduce the number of statements that are required for processing variables. For example, in the DATA step below, the values of seven data set variables are converted from Fahrenheit to Celsius temperatures.
data work.report; 
   set master.temps; 
   mon=5*(mon-32)/9; 
   tue=5*(tue-32)/9; 
   wed=5*(wed-32)/9; 
   thr=5*(thr-32)/9; 
   fri=5*(fri-32)/9; 
   sat=5*(sat-32)/9; 
   sun=5*(sun-32)/9; 
run;
As you can see, the assignment statements perform ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required