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 (August 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Aug 2006 01:21:29 -0400
Reply-To:     Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject:      Re: How to read this text file into SAS dataset.Any suggestion
              will be appreciated.
Comments: To: Jun <junliu2004@gmail.com>
In-Reply-To:  <1155786282.306783.20810@m79g2000cwm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Jun,

There is a method to make what you are doing extremely easy, You will need no data steps at all.. The entire text file can be read into memory as highly ordered data with a single function where it can be manipulated with datastep-like code to produce the output file you want. If you are interested, contact me offline, and I will share with you the SAS Component Language based solution. I am not quite ready to share these powerful techniques with the entire SAS-L community. But I will give one hint: a SCL list can be stored as a text file and read into memory (even virtual memory if the text file is very large) with a single function. Since I have described this function more than once, I will only tell you directly.

Joe

On 8/16/06, Jun <junliu2004@gmail.com> wrote: > Dear All: > > I have several text files. All these files contains titles and a table. > I just want to read in the numbers appeared in the table (not include > the number appeared in title and in the table row name and column name) > into a SAS dataset. In the SAS dataset, I want to have three columns, > the first column indicates at which column a particular number appeared > in the old table, the second column indicates at which row a > particular number appeared in the old table, the third column is the > number. The following is one sample of the text file. Any suggestion > will be appreciated. > > title > > --------------------------------------------------------------------------- > > column1 ----column2--- ---column3----- > n % n % > > ---------------------------------------------------------------------------- > AAAA 22 10.2 100 100 > BBBB 33 12.2 1200 23 > CCCC 55 8.9 42 0.3 > > --------------------------------------------------------------------------- > > > The sas dataset I want to create for the above example is as follows: > > 1 1 22 > 1 2 33 > 1 3 55 > 2 1 10.2 > 2 2 12.2 > 2 3 8.9 > 3 1 100 > 3 2 1200 > 3 3 42 > 4 1 100 > 4 2 23 > 4 3 0.3 > > > Thanks, > Jun >


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