One way is to use SAS ARRAYs and DO loops. SAS ARRAYS. A SAS ARRAY is a set of variables of the same type that you want to perform the same operation on.
The solution to overcome the inefficiency is to use a SAS ARRAY with a subsequent DO loop. We will first define two different types of arrays the indexed array
Arrays are SAS data step statements that allow iterative processing of variables and text. We will look at many examples including 1) input and output of files
statement. Arrays are SAS DATA step statements that allow clever programmers to do a great deal of work with little code. Iterative inputting of text and
Although most SAS DATA step programmers have made use of DO loops and arrays few take full advantage of the power and flexibility of these tools.
https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/179-2008.pdf
The explicit loop which utilizes the iterative DO
How can a beginning SAS programmer write less SAS code for this type of data preparation that is also more efficient? One way is to use SAS ARRAYs and DO loops.
An array and a loop can make the program smaller. A SAS array is not a new data structure the array name is not a variable
If they do not exist within a program data vector (PDV) when the ARRAY statement is compiled SAS creates them for you. •. Variables that are not previously