Date: Mon, 26 Nov 2001 05:12:52 -0500
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: process a dataset from last obs to the first
On Sun, 25 Nov 2001 16:21:33 -0500, Hongjie Wang <HWang@CYBERDIALOGUE.COM>
wrote:
>Dear friends:
>
>I wonder if there is a way to do a dataset such that we process the
>observations from bottom up?
>
>I am trying to use SAS to implement the entropy based discretization.
>According to Fayyad and Irani, we only need to consider boundary points. To
>locate boundary points, the method requires some backtracking, which is a
>pain in SAS. Otherwise, I have to let the dataset go over the process
>once, and sort the dataset in reverse and go over the process again. I
>wonder if there is a way I can reverse the process without sorting, which
>is expensive.
>
>Consider the following dataset
>
>x : 1 , 2, 3, 3 4 , 5 , 6, 6 7 , 8, 9, 9 10
>class a , a, b, b, b, a, a,, b, b, a ,b, a, a
>
>A value T in the range of the attribute x is a bounary point, iff in the
>sequence of examples sorted by x, there exist two examples, e1, e2 with
>different class such that e1<T<e2.
>In a special case, if there are multiple cases (dups) across diffferent
>classes, then the cases on either side of this group are also bounary
>points.
>
>Thanks.
>
>Hongjie
I've not analyzed your code and goals, but it is not complicated to get
direct access to obs with the point= option. You can get the number of obs
and use a loop with
do i=nobs to 1 by -1;
an example:
data test;
set sasuser.class nobs=n;
do i=n to 1 by -1;
set sasuser.class point=i;
output;
end;
stop;
run;
Don't forget the stop - statement, otherwise you will produce an endless
loop.
Another hint: the direct access does not work with compressed datasets and
with views.
set xxxx point=i
|