# A Conceptual View of Arrays

### One-Dimensional Array

The following figure is a conceptual representation of two one-dimensional arrays, MISC and MDAY.

Figure 25.1: One-Dimensional Array

MISC contains eight elements, the variables MISC1 through MISC8. To reference the data in these variables , use the form MISC{ n }, where n is the element number in the array. For example, MISC{6} is the sixth element in the array.

MDAY contains seven elements, the variables MDAY1 through MDAY7. MDAY{3} is the third element in the array.

### Two-Dimensional Array

The following figure is a conceptual representation of the two-dimensional array EXPENSES.

First Dimension

Second Dimension

Expense Categories

Days of the Week

Total

1

2

3

4

5

6

7

8

Hotel

1

hotel1

hotel2

hotel3

hotel4

hotel5

hotel6

hotel7

hotel8

Phone

2

phone1

phone2

phone3

phone4

phone5

phone6

phone7

phone8

Pers. Auto

3

peraut1

peraut2

peraut3

peraut4

peraut5

peraut6

peraut7

peraut8

Rental Car

4

carrnt1

carrnt2

carrnt3

carrnt4

carrnt5

carrnt6

carrnt7

carrnt8

Airfare

5

airlin1

airlin2

airlin3

airlin4

airlin5

airlin6

airlin7

airlin8

Dues

6

dues1

dues2

dues3

dues4

dues5

dues6

dues7

dues8

Registration Fees

7

regfee1

regfee2

regfee3

regfee4

regfee5

regfee6

regfee7

regfee8

Other

8

other1

other2

other3

other4

other5

other6

other7

other8

Tips (non-meal)

9

tips1

tips2

tips3

tips4

tips5

tips6

tips7

tips8

Meals

10

meals1

meals2

meals3

meals4

meals5

meals6

meals7

meals8

Figure 25.2: Example of a Two-Dimensional Array

The EXPENSES array contains ten groups of eight variables each. The ten groups (expense categories) comprise the first dimension of the array, and the eight variables (days of the week) comprise the second dimension. To reference the data in the array variables, use the form EXPENSES{ m,n }, where m is the element number in the first dimension of the array, and n is the element number in the second dimension of the array. EXPENSES{6,4} references the value of dues for the fourth day (the variable is DUES4).

SAS 9.1 Language Reference Concepts
ISBN: 1590471989
EAN: 2147483647
Year: 2004
Pages: 255