Hi:
If all you wanted to do was FORMAT the numbers, you did not need an array at all. You could have used
[pre]
format _ALL_ 16.;
OR
format _NUMERIC_ 16.;
[/pre]
in your DATA step program, without any ARRAY processing.
Certain statements in SAS are considered "compile time statements", as described here in the doc:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a001225397.htm
The documentation makes the distinction between "executable" statements and "declarative" statements, but also says that "declarative" statements "take effect when the system compiles program statements"
This paper is a good introduction to how the DATA step operates:
http://www2.sas.com/proceedings/sugi29/252-29.pdf
And this is specific documentation on the FORMAT statement:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000178212.htm
So, the FORMAT statement only gets used at compile time. Therefore, your do loop was not required, if all you wanted to do was apply the format to _ALL_ the variables (assuming that all the variables were numeric). Additionally, you could have used _NUMERIC_ to apply the 16. format to all the numeric variables in the data set.
You can test out the behavior of the FORMAT statement WITHOUT a do loop by running the program below. It shows both _ALL_ and _NUMERIC_. And, of course, the best place to set the format for your variables is when you are reading them into SAS data set format, if possible. I could have put the FORMAT statement in the program with the INFILE/INPUT statements. That way, I would ensure that my desired formats (and/or labels) were already in place the first time I went to use the data set.
cynthia
[pre]
data testfmt;
infile datalines;
input x y z;
return;
datalines;
6712345678901234 7821346573704321 5532652376996357
;
run;
proc print data=testfmt;
title 'proc print with no formats';
run;
** set format WITHOUT array (assumes all variables are numeric);
data withfmt;
set testfmt;
format _all_ 16.;
run;
proc print data=withfmt;
title 'New Data Set With Formats';
run;
proc contents data=withfmt;
title 'What is in Descriptor Portion of Data Set?';
run;
** what if data set has both character and numeric vars;
data withchar;
set testfmt;
longword = 'supercalifragilisticexpealidocious';
format _numeric_ 16. _character_ $34.
run;
proc print data=withchar;
title 'New Data Set With Character Variable';
run;
proc contents data=withchar;
title 'What is in Descriptor Portion of Data Set?';
run;
[/pre]