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 (January 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 17 Jan 2006 11:47:41 -0500
Reply-To:     "Dorfman, Paul" <paul.dorfman@FCSO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Dorfman, Paul" <paul.dorfman@FCSO.COM>
Subject:      Re: Data File with multiple instances
Comments: To: sdshadow@HOTPOP.COM

"sdshadow",

This is actually not difficult. Assume you file INPUT has a key ID and a satellite DATA (say, $1) to be stored into array elements, and assume the file is grouped by ID. Then:

data out ; array arr [<array size>] $ 1 <_temporary_> ; do _n_ = 1 by 1 until (last.id) ; set input ; by ID ; arr [_n_] = DATA ; <anything else you want to do for each record> end ; <at this point arr is populated> <do any array processing here> <do here anything you want after by-group ended> run ;

Whether you just guess the needed array size or pre-compute it using an idle pass or make the array incorporate variables or _temporary_ all depends on your individual needs. The intent here is just to show that having a data set in a flattened form is utterly unnecessary for the facilitation of array processing. Indeed, the flattenning process itself will unavoidably include some code similar to the above. Keep it normalized (in your sense) - SAS is best designed to process data in this form.

Kind regards ------------ Paul Dorfman Jax, FL ------------

On Tue, 17 Jan 2006 07:58:26 -0800, Midwest Financial Services <sdshadow@HOTPOP.COM> wrote:

>Question for second strategy: > >How do you read multiple observations into array(s) while leaving the >datasets normalized. I understand how if the multiple elements of the >accounts are stored in one record horizontally. Can you give an example >when the multiple elements are stored on separate records vertically? > >Are the multiple elements stored on one record horizontally? Or on >separate records >vertically? > >Answers to questions from Jiann-Shiun Huang: > >Cycle_date is predetermined and is the starting point for calculating >the Maximum days past due. A payment due for an account that cycles >10/1 would be considered past due on 10/2. >The files are merged by account number.


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