Date: Fri, 24 Aug 2001 10:04:40 -0400
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: Please help... Basic dataset problem
Content-Type: text/plain; charset="iso-8859-1"
Ace and Dianne,
I am well aware documentation about implicit arrays in historic versions of
SAS, however, I do not think that these ancient documents should be
considered part of the documentation for version 8. Now is it documented in
the Version 8 documentation? Well I did find this curious paragraph in the
documentation for two statistical procs that allow ARRAY statements by a
general search for the word implicit anywhere. Yesterday I only searched
for implicit in the language reference dictionary.
>>>>>>>>>>>>>
The ARRAY statement does not support all the features of the ARRAY statement
in the DATA step. It cannot be used to assign initial values to array
elements. Implicit indexing of variables cannot be used; all array
references must have explicit subscript expressions. ....
<<<<<<<<<<<<<<
Now will implicit arrays disappear? Fifteen years ago the SAS Institute
announced that you should be prepared to see them go. I took it seriously
and stopped using them. However, as a guesstimate 30% of the answers on
SAS-L using arrays use implicit arrays. I suggest that even the drastic
action of removing them from the documentation for version 8 will not
seriously affect usage.
I once read that the curly-queue structure that the Greeks used on the tops
of marble columns was originally used a thousand years before to hide wooden
joints. We still use them today, 3000 years after the intended purpose
disappeared. William W. Viergever [wwvierg@attglobal.net] once sent me a
note showing how the size of the booster rockets on the transport to the
moon was limited to the width of Roman war chariots.
In part I stopped using implicit arrays because documentation in version 6
said they were less efficient. However, Paul Dorfman showed some code where
they did simplify the code and he claimed that were no less efficient. I
did my own tests and came to the same conclusion. I have now started to use
the notation on some occasions. SAS will probably disappear when implicit
arrays do.
Ian Whitlock <whitloi1@westat.com>
-----Original Message-----
From: Ace [mailto:b.rogers@VIRGIN.NET]
Sent: Friday, August 24, 2001 7:41 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Please help... Basic dataset problem
On 23 Aug 01 21:02:12 GMT, RHODESD1@WESTAT.COM (Dianne Rhodes) wrote:
>Master Ian wrote a treatise on implicit and explicit areas:
>> To see that explicit mention of the implicit index is not needed consider
>
>> 160 data _null_ ;
>> 161 array x x1-x5 ;
>> 162 put _all_ ;
>> 163 run ;
>
>> _I_=. x1=. x2=. x3=. x4=. x5=. _ERROR_=0 _N_=1
>
>Ian referred to this as an undocumented feature.
Indeed, and I have to accept that the array statement syntax used is
indeed, defining an implicit array which allows explicit referencing,
as described by John and Ian.
Implicit arrays themselves are documented in the V^ Language manual,
contrary to Ian's belief, and also explain the automatic variable _I_.
This case is not explained , however and is actually somewhere between
the two camps, in that an explicit reference is perfectly acceptable
instead of using _I_, which is not the case if you've specified an
index variable in the array statement.
>Well, actually it is quite nicely documented: in version 82. It is an
>artifact to ensure backward compatibility. Back in the days that only Mike
>Zdeb and I remember,
<Waves> 79.6, anyone?
>you could write code like this:
>
>1 data _null_ ;
>2 array x x1-x12 ;
>3 do over x ;
>4 if x=. then x=0 ;
>5 end;
>6 put _all_ ;
>7 run;
>
>_I_=13 x1=0 x2=0 x3=0 x4=0 x5=0 x6=0 x7=0 x8=0 x9=0 x10=0 x11=0 x12=0
>_ERROR_=0 _N_=1
>NOTE: DATA statement used:
> real time 0.21 seconds
>
>It wasn't really an array, you used it when you wanted to treat a bunch of
>variables all the same way.
Well it is still an array, by any accepted definition of the concept,
and allowed the more normal explicitly subscripted use as well.
>So the question becomes, will SAS continue supporting DO OVER and the old
>style "array"?
Yes. He says hopefully, in the sure knowledge that he's been using
this notation (not the do over, but the array statement) in every
application he's ever delivered :-}
--
Ace in Basel