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 (July 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 24 Jul 2001 12:35:27 -0700
Reply-To:     "Huang, Ya" <ya.huang@AGOURON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@AGOURON.COM>
Subject:      Re: help with parsing (again)
Comments: To: Shannon <swheatma@FJC.GOV>
Content-Type: multipart/alternative;

Shannon,

It seems to me that your input statement is not right, you have to provide some kind of informat, especially if you have a varying length record.

Try the following, see if it is what you need:

data outline events; infile cards length=len; Do until (end); K4: input @; input line $varying200. len; linect = _N_ ; output outline; If line eq " " then goto K4; else do; testdate=substr(line,1,8); valdate=input(testdate, MMDDYY8.); end; K3: if valdate ne . then do; Evntcnt+1; evntdate=valdate; evntid=scan(line,2," "); evnttext=trim((left(substr(line,14)))); format evntdate MMDDYY8.; end; else if valdate eq . then do; evnttext=trim(evnttext)||" "||left(line); end; if end then evnttext=trim(substr(line,1)); output events; End; cards; 7/27/95 1 Bankruptcy Clerk's CERTIFICATE OF TRANSMITTAL of record on appeal received (dmk) [Entry date 07/31/95] ;

HTH

Ya Huang

> -----Original Message----- > From: Shannon [mailto:swheatma@FJC.GOV] > Sent: Tuesday, July 24, 2001 12:02 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: help with parsing (again) > > > Hello, > > I am parsing a document that looks like the following: > > 7/27/95 1 Bankruptcy Clerk's CERTIFICATE OF TRANSMITTAL of > record on appeal received (dmk) [Entry date 07/31/95] > > > The program to read this section of the document is not working right. > It is pulling off the evntdate and evntid but it is only pulling off > the first line of text and when it comes to the second line it outputs > the evntdate evntid and first and second line. If it had a third line > it would pull off the first three lines. We only want the evntdate > and evntid once and all of the evnttext should be in that same record. > Any suggestions would be greatly appreciated. Thanks - > Shannon > > Do until (end); > > K4: Input line ; linect = _N_ ; > output outline; > If line eq " " then goto K4; else > do; > testdate=substr(line,1,8); > valdate=input(testdate, MMDDYY8.); > end; > > K3: if valdate ne . then > do; > Evntcnt+1; > evntdate=valdate; > evntid=scan(line,2," "); > evnttext=trim((left(substr(line,14)))); > format evntdate MMDDYY8.; > > > end; > > else > > if valdate eq . then > do; > evnttext=trim(evnttext)||" "||left(line); > end; > > if end then evnttext=trim(substr(line,1)); > output events; > End; >


[text/html]


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