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 (February 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 23 Feb 2005 18:42:35 GMT
Reply-To:     julierog@ix.netcom.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roger Lustig <trovato@VERIZON.NET>
Subject:      Re: Reading ASCI text file
Content-Type: text/plain; charset=us-ascii; format=flowed

Dear Omugeye: Doing this dynamically in a DATA step is not something I'd want to try. But:

data long; infile stuff; input ID kount; do I=1 to kount; input var @@; output; end; run;

proc transpose data=long out=wide prefix=var; by ID; var var; id I; run;

<untested>

OK?

Roger

omugeye wrote:

> > I have a text file that goes over two lines like: > ID kount <on 1st line> > <list of Variables on 2nd line> > 1001 2 > 999 888 > 1007 8 > 111 222 333 444 555 666 777 888 > 1002 5 > 987 876 765 654 543 > . > . > . > > > I would the SAS data file to be like: > id count var1-var(Kount) > 1001 2 999 888 . . . . . > 1007 8 111 222 333 444 555 666 777 888 > 1002 5 999 888 777 666 555 . . . > > I do not know maximum kount. It needs to be determined dynamically. > > All help appreciated. >


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