LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 1999, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Oct 1999 16:58:58 +0100
Reply-To:     mr ro ashmore <rob@ESKYROB.NDO.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         mr ro ashmore <rob@ESKYROB.NDO.CO.UK>
Subject:      SCL list manipulation (copylist?)
Comments: To: SAS-L@LISTSERV.VT.EDU
Content-Type: text/plain; charset="iso-8859-1"

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.


Back to: Top of message | Previous page | Main SAS-L page