Date: Wed, 31 May 2006 11:15:32 -0400
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Defining number of elements in an array
Paul,
I think I do not fully understand: what you do not know? how many variables
should be in the variable list, or how must the dimension of the array be?
data a;
set sashelp.class;
array test(*) _numeric_;
x=dim(test); put x=;
run;
as an example. I do not know, how many numerics are in the dataset...
Is that something which you want?
Gerhard
On Wed, 31 May 2006 10:56:44 -0400, Jim Groeneveld <jim2stat@YAHOO.CO.UK> wrote:
>Hi Paul (if that's your correct identity),
>
>No, there is no better way. The array is created at compile time where the
>number of matching variables is not yet known. So the size has to be
>hardcoded or emerge from the number of variables indicated (by an implied or
>explicit range). The way via CALL SYMPUT and a macro variable, as you do, is
>the way to go!
>
>Regards - Jim.
>--
>Jim Groeneveld, Netherlands
>Statistician, SAS consultant
>home.hccnet.nl/jim.groeneveld
>
>
>
>On Wed, 31 May 2006 07:08:27 -0400, SUBSCRIBE SAS-L Anonymous
><paul555w@HOTMAIL.COM> wrote:
>
>>Hi I'm wondering if there is a better way of defining the upper boundary of
>>an array.
>>
>>arrray test [4] number1 - number4;
>>
>>if I don't know how many variables are going to be where the 4 is, how can
>>I code this differently. (So the 4 = x)
>>
>>I am currently using a symput to create a macro variable which is the
>>result of a count. I then recall this each time.
>>
>>Does anyone have a better way of doing this?
>>
>>Thanks
|