|Date: ||Wed, 31 Jul 2002 09:56:27 -0400|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|Subject: ||Re: scan function with dsd option|
To avoid inserting blanks into non-null fields, and also handle runs of
three or more consecutive tabs, operate only on adjacent delimiters and use
two nested invocations of TRANWRD.
Something like (not tested):
_infile_ = tranwrd(tranwrd(_infile_,'0909'x,'092009'x),'0909'x,'092009'x);
where 09 is the ASCII hex code for the tab and 20 is the ASCII hex code for
On Tue, 30 Jul 2002 20:18:23 -0500, Kevin Myers <KevinMyers@AUSTIN.RR.COM>
>One possibility: Use the tranwrd function to translate each delimiter
>character into a delimiter character either preceded or followed by some
>non-delimiter character (such as a space) that wouldn't interfere with your
>actual data. That would allow you to use the scan function without
>interference from consecutive delimiters. For example (non-tested code!):
>----- Original Message -----
>From: "Walter Shafron" <waltshaf@ABARE.GOV.AU>
>Sent: Tuesday, July 30, 2002 7:20 PM
>Subject: scan function with dsd option
>> I am reading a series of tab-delimited files, about 1000 characters
>> wide and want to read/extract certain fields out of this.
>> One way would be to jump columns using data step pointer controls, but
>> even with tab-delimited files the columns work in spaces (I need field
>> skips, not column skips)
>> Another idea was to read the wholeline (using the _infile_ variable)
>> and scan for the fields that I wanted. Unfortunately the scan function
>> treats contiguous delimiters as one.
>> Any ideas would be appreciated.
>> Walter Shafron