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 (June 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 14 Jun 2001 02:35:23 -0400
Reply-To:     Cybie Frontier <cybie@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Cybie Frontier <cybie@HOTMAIL.COM>
Subject:      HOW TO OUTPUT INTO MULTIPLE FILES???
Content-Type: text/plain; format=flowed

Hi Folks:

I have a SAS dataset with two variables only.

Var1 is IDNUM Var2 is ACCTNUM

Each IDNUM can have multiple ACCTNUMS. Think about one person having multiple bank accounts.

My goal is to create different SAS datasets depending on the number of ACCTNUM. So, for IDNUMS having only one account I want to output them into one file (say, FILE1), similiarly, every IDNUM that has exactly two ACCTNUMs will be in a second file. Since, I don't know what is the maximum number of accounts an IDNUM may have, I have decided to create 5 files. The first four files will have IDNUMS and the corresponding ACCTNUM having only 1 ACCTNUM, IDNUMS and corresponding ACCTNUMs having only 2 ACCTNUM, IDNUMS having only 3 ACCTNUM, IDNUMS having only 4 ACCTNUM, and the fifth file will have all those IDNUMs that have more than 4 accounts.

I would really appreciate any and all coding help. Don't have a clue about how to proceed with this one.

Secondly, instead of creating only 5 files as mentioned above, how can I create as many files as needed? In other words, how can I count how many ACCTNUM one IDNUM has and then automatically output that IDNUM along with the ACCTNUMs to the appropriate file?

Example:

original File

IDNUM ACCTNUM 1 100 1 101 2 200 3 300 3 301 3 302 4 400 4 401 5 501

After manipulation:

File 1 IDNUM ACCTNUM 2 200 5 501

FILE2 1 100 1 101 4 400 4 401

FILE3 3 300 3 301 3 302

Thank you very much for all your help.

CF

_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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