Date: Wed, 5 Mar 1997 17:48:42 -0500
Reply-To: rcoleman@worldnet.att.net
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Ron Coleman <rcoleman@WORLDNET.ATT.NET>
Organization: AT&T WorldNet Services
Subject: Re: Embedded Spaces in String
Content-Type: text/plain; charset=us-ascii
Mitch II wrote:
>
> I am using the following code to read a fixed column ascii file.
>
> I am experiencing a problem with embedded spaces in both MOMPATID and
> KIDPATID. Both fields sometimes contain multiple contiguous spaces. SAS
> does not read these fields correctly when it encounters the embedded
> spaces.
>
> I have tried setting a different delimiter. I have tried using a $CHAR
> informat. Same result.
>
> I should get 1020 observations. I get 619 and a message that SAS went to
> a new line when INPUT reached past the end of the line.
>
> I used column input precisely because SAS is supposed to ignore multiple
> spaces in a string field.
>
> I am using SAS 6.11 for Windows. It is running on Windows 95 on a 133MHz
> Pentium.
>
> Suggestions to resolve this problem would be welcome.
>
> Thanks,
>
> Mitch
>
> data LINKAGE.KNOWN;
> infile KNOWN;
> input FACILITY $ 1- 6
> RPT_YY $ 8- 9
> RPT_QTR $ 13
> MOMPATID $ 18-34
> SSN $ 36-44
> @46 DOB MMDDYY8.
> KIDPATID $ 57-73 ;
>
> run;
Mitch,
The reason for the message about skipping to another record is that some
of your data lines may be shorter than 73 characters (KIDPATID < 17
chars). Use the MISSOVER option on your INFILE statement to stop SAS
from jumping to the next line.
INFILE KNOWN MISSOVER;
I have always had good success using formatted input over column. Use:
input @01 FACILITY $6.
@08 RPT_YY $2.
@13 RPT_QTR $1.
@18 MOMPATID $17.
@36 SSN $9.
@46 DOB MMDDYY8.
@57 KIDPATID $17.;
If this doesn't work I would need to see some of the actual input
records to go much further.
--
Ron Coleman A SAS Quality Partner.
Links Analytical, Inc. Linking your data to your business!
3545-1 St. Johns Bluff Rd. Suite 300
Jacksonville FL 32224
rcoleman@worldnet.att.net