Date: Wed, 11 Dec 2002 17:06:03 -0500
Reply-To: Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject: Re: Parent/Child relationships
Content-Type: text/plain; charset="iso-8859-1"
If it is safe to assume that the name always begins with a letter, an
alternate approach would be to use the INDEXC function to find the position
of the leftmost letter, and then use that information both to determine the
indentation level and to tell you where to start reading the name.
Mike Rhoads
Westat
RhoadsM1@Westat.com
-----Original Message-----
From: Howard_Schreier@ITA.DOC.GOV [mailto:Howard_Schreier@ITA.DOC.GOV]
Sent: Wednesday, December 11, 2002 5:00 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Parent/Child relationships
What does "!" signify? Why does LLLLLLLL's line not have "-- " after "+"?
I'll ignore these issues for now.
A few ideas.
Use @"+-- " pointer control along with INFILE's COLUMN= option to position
the pointer and detect indentation level. First generation (unindented)
lines won't hit, but I think if MISSOVER is in effect pointer will end up at
column 1, which is appropriate. Or will it end up at the high end? If so,
comparison with a variable loaded by the LENGTH= option should permit
detection.
Have a RETAINED variable to remember the previous line's indentation level
and a RETAINED array to remember the current ancestry sequence at all times.
When indentation drops back (as between HHHHHHHH and IIIIIIII), make
appropriate "erasures" in the array.
That should deliver the information needed to identify the parent for each
record as it is processed.
On Wed, 11 Dec 2002 09:34:40 +0100, Alex Benny Nielsen <albni@TDC.DK> wrote:
>I am trying to build a parent/child relationship from a "flat" file looking
>like this :
>< AAAAAAAA
>
>< +-- BBBBBBBB
>
>< +-- CCCCCCCC
>
>< +-- DDDDDDDD
>
>< ! +-- EEEEEEEE
>
>< ! +-- FFFFFFFF
>
>< ! +-- GGGGGGGG
>
>< ! +-- HHHHHHHH
>
>< +-- IIIIIIII
>
>< +-- JJJJJJJJ
>< +--KKKKKKKK
>< +LLLLLLLL
>
>for input to either proc netdraw or treeview.
>Any ideas.
>This is just an example.There could be many more levels.
>
>Regards
>Alex B. Nielsen
>TDC Services A/S
>Operation Management
>Copenhagen,Denmark
>* E-mail : mailto:albni@tdc.dk