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 (August 1996, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Aug 1996 12:19:24 -0700
Reply-To:     Ronald Max Atwood Jr <matwood@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Ronald Max Atwood Jr <matwood@IX.NETCOM.COM>
Subject:      Input problem

Hi Y'all:

I have run into an interesting input problem and thought I would check to see if any one out here is SAS-l land has run into this before.

I have a "text" file that is supposed to be column delimited. I am not sure of the actual source of the file. I believe it was produced by an SQL query in ORACLE but I could not swear to that.

As with all nice data sets there are supposed to be a fixed number of fields on any given line. However, in this case one field does not always have a value. On those lines were there is no value, there appears to be some sort of tab causing the pointer (in my text editor) to jump to the beginning of the next field. However, this "tab" effect does not carry over in SAS in the input statement. When I try to read specific data from specific colunms (using the @ symbol) I get erroneous results on those lines with the tab like effect. Something like the following:

Text file (as it appears in my text editor):

1111 2222 3333 4444 5555 1111 2222 3333 5555

Data dns; .. input @1 field1 $4. @6 field2 $4. @11 field3 $4. @16 field4 $4. @21 field5 $4.; .. run;

In the case of line 1, the input is working fine. In the case of line 2, positions 16-19 are not occupied by blanks (i.e. simply missing data) there is some sort of tab effect so that position 16 is infact the beginning of field5.

The results of the data step seem to vary depending of the varyous approachs I take at the input process. The straight forward approach implied above gives the anticipated results for line 1. On line 2 I get field5 data in field4 and missing data in field5.

The above example is a simplification of the real data set and input process. My questions to the SAS-L are: what kind of "text" file have I run into? What is it I am seeing in field4? Does anyone out there have any ideas how to read this file correctly?

I am working in SAS611 on a Sun1000 workstation under SunOS2.3.

Thanks in advance for any assistance.

Max Atwood (matwood@ix.netcom.com)


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