Date: Tue, 29 Jul 2008 08:47:42 -0400
Reply-To: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject: Re: addressing the data column as an "Array"
In-Reply-To: <86002daf-19ba-47b2-9a51-f6cfd94c3c71@j7g2000prm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
On Tue, Jul 29, 2008 at 7:15 AM, kunal <kunal.krishnan@gmail.com> wrote:
> Hi everyone!!
>
> I am trying to automate the multiplicative model(a double log model).
> I have managed to do a bit of automation by using merge statements.
>
> The process can be significantly automated if we can use the column as
> an array.
>
> For eg:
>
> Marks
> 55
> 63
> 75
> 34
> 88
> 93
>
> Marks is the column name and the values listed are the row values. Can
> i know access column values as an array value such that a[0] = 55 ,
> a[1] = 63 and so on.??
>
> can any1 gime me any pointers or code for doing this
> ??
>
> Thanks
> Kunal
>
Kunal,
You can have it. In one pass of dataset (within a datastep) you can load the
values(Marks) into a TEMPORARY array say:
array a[NUM] _temporary_;
NUM is the number of Distinct values of Marks.
In the next Pass, within the same datastep, you can use a[1], a[2] ...
a[NUM].
If you want to use a[0] to a[NUM] then declare the array (having NUM + 1
elements) as:
array a[0:NUM] _temporary_ ;
If you show some small example dataset then someone will show you the way to
go with temporary array.
Muthia Kachirayan