Hi:
As a teacher, I am honor bound to add some SAS-related elaboration to the post about A1-A4 as being in ARRAY A.
In some languages, the list of variables or fields named A1-A4
WOULD automatically be an array reference to the array named A. And the array named A would, in some languages, be a physical data construct.
In SAS, however, an ARRAY is
not a physical data construct. The name of the array is declared in an ARRAY statement (either in a DATA step program or in some of the STAT procedures that allow ARRAY references) and does not have to bear any relationship at all to the numbered (or unnumbered) variable list that defines the array members.
So, for example, these are all valid ARRAY declarations in a SAS DATA step program (for numeric variables):
[pre]
array a a1-a4;
array wombat a1-a4;
array unord a3 a1 a4 a2;
array lovelucy fred ethel lucy ricky;
[/pre]
Only the first ARRAY statement declares the variable name to be 'A'. In the above ARRAY statements, the references point to the following variables:
[pre]
Array Array Refers to
Name Reference SAS Variable
-------- ----------- -----------
A A(2) A2
WOMBAT WOMBAT(2) A2
UNORD UNORD(2) A1
LOVELUCY LOVELUCY(2) ETHEL
[/pre]
When a SAS dataset is not actively being used in a DATA step program, you will never see the declared array NAME (A, WOMBAT, UNORD, or LOVELUCY) in the descriptor portion of the SAS dataset (as with a PROC CONTENTS or a PROC DATASETS). You -will- see the variables, ALL the variables, in the descriptor portion of the dataset.
So, if your dataset contains numbered variables, such as A1, A2, A3, A4 or YR1999, YR2000, YR2001, YR2002, it sometimes becomes tedious to list all the variables one after the other in code. Many SAS statements, functions and options allow you to use variable lists (in a variety of forms), as shown in the documentation, as a referencing shortcut.
For example, if you use the SUM function, the use of 'OF' in the SUM function, as described here:
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000245953.htm
You could have:
[pre]
total = sum(a1, a2, a3, a4);
OR
total = sum(lucy, ricky, fred, ethel);
OR
total = sum(OF a1-a4);
OR
total=sum(OF a1-a4, a5, a6);
[/pre]
IF you had declared an ARRAY in a DATA step program, you might use a DO loop to accumulate or create a new variable from the members of an array. However, the original question was about the SUM function, so I'll end here. The bottom line is that numbered variables do not automatically mean that the numbered variables are in an ARRAY -- that is frequently one usage of numbered variables -- but not an automatic usage.
cynthia