Syntax, ARRAY statement:
ARRAY array-name [number-of-elements] <array-elements>;
Note: The number of elements must
be enclosed in either parentheses ( ), braces { }, or brackets [ ].
|
array health[5] Weight Temp Pulse Resp BP;
array health[2:4] Temp Pulse Resp;
array health[*] Weight Temp Pulse Resp BP;
array health(5) Weight Temp Pulse Resp BP;
array health{5} Weight Temp Pulse Resp BP;
array health[5] Weight Temp Pulse Resp BP;
array health[5] Weight Temp Pulse Resp BP;
array health[5] Weight--BP;
Column
|
Description
|
Form
|
---|---|---|
Numbered range list
|
Specifies all columns
from x1 to xn inclusive. You
can begin with any number and end with any number as long as you do
not violate the rules for user-supplied column names and the numbers
are consecutive.
|
x1–xn
|
Name range list
|
Specifies all columns
ordered as they are in the program data vector, from x to b, inclusive.
|
x- - b
|
Specifies all numeric
columns from x to b, inclusive.
|
x-numeric-b
|
|
Specifies all character
columns from x to b, inclusive.
|
x-character-b
|
|
Name prefix list
|
Specifies all the columns
that begin with REV, such as REVJAN, REVFEB, and REVMAR.
|
REV:
|
Special SAS name lists
|
Specifies all numeric
columns that are already defined in the current DATA step.
|
_NUMERIC_
|
Specifies all character
columns that are already defined in the current DATA step.
|
_CHARACTER_
|
|
Specifies all columns
that are already defined in the current DATA step.
Note: Variables must be either
all numeric or character.
|
_ALL_
|
array-name[element-number]
health[3]
Syntax, DO statement:
DO index-column =
1 TO number-of-elements;
.
. . array-name[index-column].
. .
|
data work.highcount; set certadv.patdata; array health[5] Weight--BP; do i = 1 to 5; if health[i]='High' then HighCount+1; end; run;
array Ordt[*] Ordt:;
array Deldt[*] Deldt:;
array Q[*] Q:;
Syntax, DIM function:
DIM(array-name)
|
data work.sysbp2 (drop=i); set work.sysbp; array sbparray[*] sbp:; do i=1 to dim(sbparray); if sbparray[i]=999 then sbparray[i]=.; end; run;
data work.survsalary (drop=i); set certadv.salary; array BelowAvgS[4] Salary1-Salary4; do i=1 to 4; if BelowAvgS[i] <=51000 then BelowAvg+1; end; run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i);
set certadv.salary;
array BelowAvgS[4] Salary1-Salary4;
do i=1 to 4;
if BelowAvgS[i] <=51000 then BelowAvg+1;
end;
run;
data work.survsalary (drop=i); set certadv.salary; array BelowAvgS[4] Salary1-Salary4; do i=1 to 4; if BelowAvgS[i] <=51000 then BelowAvg+1; end; run;