data ex(drop= i j);
array num(9) _temporary_ (1,2,3,4,5,6,7,8,9);
array n(9) $;
do i=1 to dim(num);
do j=1 to i;
n(j)=cats(num(j),'*',num(i),'=',num(j)*num(i));
end;
output;
end;
run;
data _null_;
array num(9) _temporary_ (1,2,3,4,5,6,7,8,9);
length str $200;
do i=dim(num) to 1 by -1;
call missing(str);
do j=1 to i;
str=cat(strip(str)," ",cats(num(j),'*',num(i),'=',num(j)*num(i)));
end;
put str;
end;
run;
这是非数组的方法。
DATA D9;
DO I=1 TO 9;
DO J=1 TO I;
X=I*J;
PUT @(3*J) X @;
/* @(expression) moves the pointer to the column */
/* that is given by the value of expression. */
END;
PUT;
/* The null PUT statement releases an output line that is */
/* being held by a previous PUT statement with a trailing @. */
END;
RUN;