Date: Sat, 30 Oct 1999 23:14:10 -0400
Reply-To: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Organization: MindSpring Enterprises
Subject: Re: SCL list manipulation (copylist?)
Small correction
replace the
rc = insertN (haveit, n);
with
rc = insertN (getitemL(theList,haveit), n);
Richard DeVenezia <radevenz@ix.netcom.com> wrote in message
news:7vd3hf$bkt$1@nntp5.atl.mindspring.net...
> Use named items.
>
> thelist = makelist();
>
> do while not eof
>
> n+1;
> {read charvalu}
>
> haveit = nameditem (charvalu);
>
> if not haveit then do;
> rc = insertL (theList, makelist(), 1, charvalu);
> haveit = nameditem (charvalu);
> end;
>
> rc = insertN (haveit, n);
>
> end;
>
> rc = sortlist (theList, 'NAME');
>
> mr ro ashmore <rob@ESKYROB.NDO.CO.UK> wrote in message
> news:000f01bf2226$a7ed1f60$3feb07c3@default...
> > I have an external file which looks similar to this:
> > a
> > a
> > b
> > c
> > a
> > c
> >
> > etc.
> >
> > what i want to do is create an scl list (resultL) which, given the above
> > file,
> > looks like this:
> >
> > RESULTL ( A= (1 2 5) B=(3) C=(4 6) )
> >
> > the numbers represent which record numbers the letter was found.
> >
> > At the outset, it seems a pretty straightforward task:
> > - read in the record using FREAD function.
> > - create a list (recordL) containing the record number using INSERTN
> > - creat scl variable LETTER which is the value of the line eg A or B or
C
> > - create resultL list with recordL as the nameditem .
> > - cycle through each record, adding to the named item list for that
> LETTER
> >
> > But we hit problems when the first 'letter change' is encountered, in
> this
> > example record 3 where LETTER changes from a to b. If we clear the list
> > using
> > CLEARLIST the list identified by 'A=' is cleared also. If we dont, the
> > values 1, 2 are
> > still in the list. It looks like it is necessary to use COPYLIST
> > recursively somehow.
> >
> > It may be simpler to read through the file a number of times but nowhere
> > near as tidy!
> >
> > any ideas??
> >
> > TIA rob.
>
>
|