Date: Sat, 5 Mar 2011 10:48:59 -0800
Reply-To: Núria Chapinal <nchapinal@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Núria Chapinal <nchapinal@YAHOO.COM>
Subject: Re: how to treat consecutive delimiters as one when importing txt
files
In-Reply-To: <201103051837.p25BpTDD030299@waikiki.cc.uga.edu>
Content-Type: text/plain; charset=iso-8859-1
I deleted the DSD option and it looks like it is working fine. I do thave missing values, but they appear as '--' in the txt files and then as periods in the final SAS dataset. So I guess I can use that to differentiate them from 2 consecutive tabulations ,right? I think it is what the code is doing right now. Is there any specific piece in my code that is specifying "change -- into ."? I do not think so. Is it because I am specifying numerical format and then anything that is not numerical becomes a .?
I am still worried that missing values and consecutive tabulations can get mixed up. Can we add something else to make use of the -- and avoid confusion?
Núria Chapinal
Postdoctoral fellow
Animal Welfare Program, University of British Columbia
Department of Population Medicine, University of Guelph
--- On Sat, 3/5/11, Arthur Tabachneck <art297@ROGERS.COM> wrote:
From: Arthur Tabachneck <art297@ROGERS.COM>
Subject: Re: how to treat consecutive delimiters as one when importing txt files
To: SAS-L@LISTSERV.UGA.EDU
Received: Saturday, March 5, 2011, 1:37 PM
Nuria,
Ignoring multiple delimiters also implies that you don't have any missing
values. If you don't have any missing values, then you could probably do
what you want by including code to change the tabs into blanks and then use
the & modifier.
Art
--------
On Sat, 5 Mar 2011 13:17:35 -0500, Nuria Chapinal <nchapinal@YAHOO.COM>
wrote:
>On Tue, 1 Mar 2011 11:54:33 -0500, Nuria Chapinal <nchapinal@YAHOO.COM>
>wrote:
>
>>Thanks a lot for all your help.
>>
>>This is one of the codes for one of the batches:
>>
>>
>>filename FT46F001 'C:\Users\nuria\Desktop\am\fc\*.txt' lrecl=256;
>>data fresh;
>> length fname $256;
>> infile FT46F001 dsd dlm='09'x eov=eov filename=fname noexpandtabs
>missover;
>> input @;
>> if _n_ eq 1 or eov then do;
>> *filename=fname;
>> date = input(scan(fname,-2,' '),mmddyy10.);
>> retain filename date;
>> eov = 0;
>> input #5;
>> delete;
>> end;
>>input (index cow lact group)(:??) cdate :mmddyy10. (dim c1-c26 )(:??);
>>format date cdate mmddyy10.;
>> run;
>
>Hi,
>
>I ran into a small trouble when using the codes above. Some times there
>are 2 tabulations in a row separating columns. I would need an option that
>did the same as the option "treat consecutive delimiters as one" in
>Excel...
>
>Thanks in advance!
|