Date: Wed, 27 Sep 2006 21:37:58 -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: Reading in raw files and concatenating text
In-Reply-To: <MPG.1f84ba875998e31d9896f0@news.chi.sbcglobal.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Paula,
Not all of us. Some of us don't think the advice you have been given
is all that wonderful. For example, no one mentioned that a single
SAS Component language FILLIST function could read the text file you
have into a SCL List which would facilitate all the text manipulations
you could want. There are many examples in the SAS-L archives.
Joe
On 9/27/06, Paula Sims <me@here.com> wrote:
> Thank you all for the wonderful responses. I learned a great deal and in
> the end used Manuel's version. However, I am intrigued about the issue
> of the view and will explore this further for other applications.
>
> You are all WONDERFUL!
>
> Paula
>
>
>
> In article
> <092720061451.5120.451A8FEB0007684600001400220076106405029A06CE9907
> @comcast.net>, iw1junk@COMCAST.NET says...
> > Summary: Use View to handle BY processing of sorted external data
> > #iw-value=2
> >
> > Paula,
> >
> > Nothing wrong with some of the answers you already have, but the
> > opportunity is too good to not point out the advantage of a view.
> >
> > First create data.
> > filename q temp ;
> > data _null_ ;
> > input ;
> > file q ;
> > put _infile_ ;
> > cards4;
> > 1234;1; ; ; ; ; ;Four score and seven years ago our fathers brought;
> > 1234;2; ; ; ; ; ;forth on this continent, a new nation, conceived in
> > 1234;3; ; ; ; ; ;Liberty, and dedicated to the proposition that all;
> > 1234;4; ; ; ; ; ;men are created equal;
> > 2345;1; ; ; ; ; ;To be or not to be;
> > 3456;1; ; ; ; ; ;When in the course of human events it becomes;
> > 3456;2; ; ; ; ; ;necessary for one people to dissolve the political;
> > ;;;;
> >
> > Now we have a file as you describe. Make the view (no data pass).
> >
> > data v (drop=skip)/ view=v ;
> > infile q dsd dlm=";" ;
> > input id $ seq skip $ skip $ skip $ skip $ skip $ ln :$80.
> > ;
> > run ;
> >
> > Use the view with standard SAS tools.
> >
> > data w ( drop = seq ln ) ;
> > length line $ 1000 ;
> > do until ( last.id ) ;
> > set v ;
> > by id seq ;
> > line = trim(line) || " " || ln ;
> > end ;
> > run ;
> >
> > I would use CATX function in version 9 to combine the lines, but
> > I am working at a computer with only 8.2.
> >
> > Ian Whitlock
> > ==============
> > Date: Wed, 27 Sep 2006 00:40:20 GMT
> > Reply-To: Paula Sims <me@HERE.COM>
>
--
To paraphrase G. Santayana, the SAS Macro Facility used by common SAS
programmers is an old mate that gives no pleasure and many headaches,
yet she/he cannot live without it, and resents any aspersions that
strangers may cast on its character
|