Date: Sun, 20 Aug 2006 16:47:57 -0700
Reply-To: ChrisW75 <9Squirrels@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: ChrisW75 <9Squirrels@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: How to read this text file into SAS dataset. Thanks.
In-Reply-To: <1155940721.298784.293570@i3g2000cwc.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Jun,
You should have added this to the original post so we could see what
the previous responses were. I remember that I answered this one, what
was the problem with my earlier response? Where did it fall down? I
can't find my earlier response, but I think I would have suggested
using column input then doing post-processing on the file to transpose
it.
One thing alot of people miss is that rather than spending a week
trying to write a program to handle every possible permutation of the
badly formatted datafile, sometimes it's better to just go back to the
supplier and ask for it in a better format. Sometimes it's just a
simple matter to get them to change the extract process or whatever.
ChrisW75
Jun wrote:
> Dear All:
>
> I asked this question two days ago and have recieved several replys.
> One of them works for the example I provided. But I forgot to provide
> some details about the table. So I have to ask you help again with a
> new sample table. Thanks a lot.
>
> 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.
> Note: 1.column is like description and it may contain several words.
> 2. There are may have some missing value in the table.
> title
>
> -------------------------------------------------------------------------------------------------
>
> column1 ----column2--- ---column3-----
> Cloumn3
> n % n %
>
> ------------------------------------------------------------------------------------------------
> A AAA 22 100
> 0.33
> BB B B 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 .
> 2 2 12.2
> 2 3 8.9
> 3 1 100
> 3 2 1200
> 3 3 42
> 4 1 .
> 4 2 23
> 4 3 0.3
> 5 1 0.33
> 5 2 .
> 5 5 .
>
> Thanks,
> Jun
|