Date: Fri, 11 Feb 2005 23:55:58 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Pipe Delimited Infile Issue
My theory is that where wrapping occurs, you have a pipe delimiter
immediately before the newline. Since the newline itself is a delimiter in
this context, the two adjacent delimiters yield a missing value and
displacement of subsequent fields, as observed.
Eliminating the DSD option might help, but it might not be acceptable, if
you have legitimate null fields to preserve.
Posting a few lines of test data would indeed be a big help. I don't think
the number of fields or their length are factors, so you should be able to
replicate the problem with just three or four short fields.
On Wed, 9 Feb 2005 05:44:34 -0800, setar@MINDSPRING.COM wrote:
>I am attempting to read in a pipe delimited file that contains 16
>fields. Some of the records in the input file span across multiple
>rows which seems to present problems.
>
>I am using the following statement to read in the data:
>
>data output;
> infile input DLM="|" dsd;
>
> input
>
> VAR1: $10.
> VAR2: $75.
> VAR3: $125.
> VAR4: $20.
> VAR5: $40.
> VAR6: $6.
> VAR7: $9.
> VAR8: $9.
> VAR9: $12.
> VAR10: $10.
> VAR11: $10.
> VAR12: $10.
> VAR13: $25.
> VAR14: $10.
> VAR15: $15.
> VAR16: $15.
>
>The first data issue appears to take place at last field at the end of
>the first line of a record that spans multiple lines. For example, the
>first line of the input file wraps after the 3rd delimiter. The
>resulting table from the read-in contains no value for the 4th field
>and then the field contents begin to shift to the right by one field.
>The data eventually comes back into shape when a record is encountered
>where no wrapping occurs (due to shorter field contents).
>
>I have experimented with the truncover/flowover infile option as well
>as trying to specify lrecl, but to no avail.
>
>It almost appears as if SAS may be reading blanks after that 3rd
>delimiter or somehow a carriage return is encountered and
>mis-interpretted.
>
>I am thinking that somehow the line or column pointer could help, but I
>am not quite sure how/if that will effectively work with delimiters
>given the variable lengths.
>
>I do have a small test data file if it would help to see the actual
>data. Due to the width of each line, it would not be represented well
>in this editor.
>
>Any help would be greatly appreciated.
|