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 (April 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 18 Apr 2007 12:22:42 -0700
Reply-To:     "Mogens A. Krogh" <MKROGH@DSR.KVL.DK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Mogens A. Krogh" <MKROGH@DSR.KVL.DK>
Organization: http://groups.google.com
Subject:      Re: Reading delimited data on multiple lines
Comments: To: sas-l@uga.edu
In-Reply-To:  <1176910181.653632.14580@q75g2000hsh.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear Don, Try to take a look at this. The idea is that each complete line should have 4 delimiters. You can now read the string_ok variable whit the scan-function. It can most likely be done a lot 'nicer' but this would be my quick solution to this.

Regards Mogens A. Krogh www.life.ku.dk

DATA NOTOK (keep=string_ok); length string_part $25.; INFILE DATALINES DLM="#" DSD; INPUT string $40.;

if length(compress(string,'#','k'))=4 then string_ok=string;

if flag=1 & length(compress(string,'#','k'))<4 then do; string_ok=compbl(string_part || string); flag=0; end; if length(compress(string,'#','k'))<4 then do; string_part=string; string=' '; flag=1; end; retain flag string_part; if string_ok ne ' ' then output; DATALINES; 1#2#HELLO KIDDO##8 3#4#GOODBYE KIDDO#9#7 5#6#MAMA WINS## ; run;


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