Date: Wed, 1 Apr 2009 15:17:48 -0400
Reply-To: "oloolo (dynamicpanel@yahoo.com)" <dynamicpanel@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "oloolo (dynamicpanel@yahoo.com)" <dynamicpanel@YAHOO.COM>
Subject: Re: Alternative Implementation of the "SAS Terminator"
Hi, Chang
Try id="T". The "T" family (ToNode=773500764) is tricky. A man-made
Graph is like the following (omit leading digits):
In the graph, (dd) indicates stop at branches while (D) indicates continue
spanning on main stream. Sorensen's program gives a portion but not
complete list of this node.
I think it over again, and I figured that it may be due to the
difference in nature of the problem. Sorensen's program goes directly from
the root, and grow the graph to leafs, while my business problem is that
given any transaction in our system, find all historical deals finally lead
to this transaction.
Anyway, below is the graph for ID='T' I worked out manually. If it is
wrong, let me know.
*****************************;
764 ->327->791(stop)
\->293-->800
/\
/ \
807 814
| /\
V / \
830<-813(D) 813(dd)
|
V
833
/\
/ \
845(dd) 845(D)
|
V
879
/\
/ \
403 885
On Wed, 1 Apr 2009 14:06:20 -0400, Chang Chung <chang_y_chung@HOTMAIL.COM>
wrote:
>On Wed, 1 Apr 2009 13:42:21 -0400, oloolo (dynamicpanel@yahoo.com)
><dynamicpanel@YAHOO.COM> wrote:
>
>>But your solution seems do not work on this more complex sample which I
>>worked with.
>...
>hi, oloolo,
>i am not S Lassen, but i am not sure what you mean by Lassen's solution not
>working. This seems working fine. hth.
>Cheers,
>Chang
>
>data main;
> input id $ lengthkm fromnode tonode startflag branch;
>datalines;
> T 0.43 773501327 773500764 0 0
> kk 1.19 773501293 773501327 0 1
> S 0.82 773500791 773501327 1 0
> R 4.53 773500796 773500769 0 0
> P 3.47 773500809 773500796 0 0
> O 1.02 773500821 773500809 0 0
> nn 0.86 773500836 773500821 0 1
> N 1.08 773500836 773500821 0 0
> M 1.14 773500218 773500836 1 0
> hh 0.89 773500807 773500809 0 1
> Q 0.29 773500778 773500796 0 0
> ll 0.18 773501344 773500778 0 1
> L 0.62 773501344 773500778 0 0
> K 0.09 773501293 773501344 0 0
> J 1.78 773500800 773501293 0 0
> H 0.43 773500807 773500800 0 0
> ff 0.40 773500830 773500807 0 1
> I 0.31 773500814 773500800 0 0
> gg 0.42 773500813 773500814 0 1
> G 0.56 773500813 773500814 0 0
> F 0.17 773500830 773500813 0 0
> E 2.10 773500833 773500830 0 0
> dd 0.14 773500845 773500833 0 1
> D 0.44 773500845 773500833 0 0
> C 1.36 773500879 773500845 0 0
> B 3.42 773500403 773500879 1 0
> A 3.79 773500885 773500879 1 0
>;
>run;
>
>/* let us get all the ids of S^s decendants
> using S Lassen^s data step solution */
>proc datasets lib=work;
> modify main;
> index create fromnode;
> quit;
>
>data sfamily;
> set main(where=(id="S"));
> level = 0;
>run;
>
>data sfamily;
> modify sfamily;
> fromnode = tonode;
> level + 1;
> if 100 <= level then stop;
> do while(1);
> set main key=fromnode;
> if _iorc_ | startFlag | branch then leave;
> output;
> end;
> _error_ = 0;
>run;
>
>proc print data=sfamily noobs;
> var id fromnode tonode;
>run;
>/*
>id fromnode tonode
>
>S 773500791 773501327
>T 773501327 773500764
>*/
|