Date: Tue, 8 Feb 2000 23:44:34 GMT
Reply-To: "Daniel J. Nordlund" <dnordlund@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Daniel J. Nordlund" <dnordlund@AOL.COM>
Organization: AOL http://www.aol.com
Subject: Re: The INPUT INFILE DELIMITER thing
sarthur67@YAHOO.COM (Stephen Arthur) wrote:
>
>SAS,
>
>I have a text file that is both tab and space
>delimited (and some times not always in the same order
>per record). I have read in the SAS Language manual
>that if you use the DELIMITER= option in the INFILE
>statement that one is allowed to include more than one
>value in the delimiter quotes following the equals
>sign. Problem is, is that the tab symbol is
>represented as a "'09'x" symbol which doesn't appear
>to leave much space for this format stated in the
>manual or whatever the space symbol would be, if it is
>not a "' '" to begin with. Any help?
>
>My current INFILE/INPUT looks like:
>
>*****************************************************;
>data params;
>infile "&inpath.&infile2"
>delimiter = '09'x stopover firstobs = 2;
>input id $ 2 pound $ 1 label $ 20 value1 $ 18 value2 $
>18 value3 $ 12 value4 $ 3 value5 $ 12;
>run;
>*****************************************************;
>
>where the '$ number' values are not necessarily set at
>this point.
>
>Some example data, you ask?:
>
>Labels:
>ID Pound Label Value1 Value2 Value3 Value4 Value5
>Value6:
>81 # ABCD.a0_0693 54.3506187455156
>(189.244532688029)6.558673469 24 87.56851228
>Data line 2:
>82 # ABCD.a0_0427 56.1189493637957
>(207.778607459927)15.92592593 24 86.00082968
>
>Provided.
>
>Where Value1 and Value2 are separated by a space and
>all other values are separated be tabs, and all
>variables may have different lengths.
>
>steve
>
>
Steve,
I have to guess where spaces and tabs are in your data, so I haven't presented
tested code. However,
1. you should be able to specify your delimiter as:
dlm='0920'x
2. it looks like you are trying to specify variable widths on the input
statement. You should use a LENGTH statement before the infile to specify the
maximum length of your character variables. Only use the $ sign on the input
statement to indicate which variables are character. For example,
input id $ pound $ label $ value1 value2
value3 value4 value5 ;
The example assumes the VALUEn variables numeric and the others are
non-numeric.
Hope this helps,
Dan Nordlund
Hope this helps.
|