Syntax, ARRAY statement
to create new variables:
ARRAY array-name{dimension};
|
data hrd.diff;
set hrd.convert;
array wt{6} weight1-weight6;
data hrd.diff;
set hrd.convert;
array wt{6} weight1-weight6;
array WgtDiff{5};
run;
proc print data=hrd.convert;
run;
array WgtDiff{5};
array WgtDiff{5};
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
WgtDiff1 WgtDiff2 WgtDiff3 WgtDiff4 WgtDiff5
array WgtDiff{5} Oct12 Oct19 Oct26 Nov02 Nov09; array WgtDiff{5}; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Oct12 Oct19 Oct26 Nov02 Nov09
array firstname{5} $;
array firstname{5} $ 24;
data hrd.diff;
set hrd.convert;
array wt{6} Weight1-Weight6;
array WgtDiff{5};
data hrd.diff; set hrd.convert; array wt{6} weight1-weight6; array WgtDiff{5}; do i=1 to 5; wgtdiff{i}=wt{i+1}-wt{i}; end; run; proc print data=hrd.diff; run;
array goal{4} g1 g2 g3 g4 (initial values);
array goal{4} g1 g2 g3 g4 (9000 9300 9600 9900);
↓ ↓ ↓ ↓ array goal{4} g1 g2 g3 g4 (9000 9300 9600 9900); ↑ ↑ ↑ ↑
↓ ↓ ↓ array goal{4} g1 g2 g3 g4 (9000 9300 9600 9900);
↓ ↓ array goal{4} g1 g2 g3 g4 (9000 9300 9600 9900);
↓ ↓ ↓ ↓ ↓ ↓ array col{3} $ color1-color3 ('red','green','blue');
array Var{4} (1 2 3 4);
data finance.report;
set finance.qsales;
array sale{4} sales1-sales4;
data finance.report;
set finance.qsales;
array sale{4} sales1-sales4;
array Goal{4} (9000 9300 9600 9900);
data finance.report;
set finance.qsales;
array sale{4} sales1-sales4;
array Goal{4} (9000 9300 9600 9900);
array Achieved{4};
do i=1 to 4;
achieved{i}=100*sale{i}/goal{i};
end;
run;
data finance.report; set finance.qsales; array sale{4} sales1-sales4; array Goal{4} (9000 9300 9600 9900); array Achieved{4}; do i=1 to 4; achieved{i}=100*sale{i}/goal{i}; end; run;
data finance.report(drop=i);
set finance.qsales;
array sale{4} sales1-sales4;
array Goal{4} (9000 9300 9600 9900);
array Achieved{4};
do i=1 to 4;
achieved{i}=100*sale{i}/goal{i};
end;
run;
proc print data=finance.report;
run;
data finance.report(drop=i);
set finance.qsales;
array sale{4} sales1-sales4;
array goal{4} _temporary_ (9000 9300 9600 9900);
array Achieved{4};
do i=1 to 4;
achieved{i}=100*sale{i}/goal{i};
end;
run;
proc print data=finance.report noobs;
run;