Date: Mon, 19 May 2008 10:39:59 -0400
Reply-To: Talbot Michael Katz <topkatz@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Talbot Michael Katz <topkatz@MSN.COM>
Subject: Re: Transfer from Windows to UNIX
Hi.
Thank you for the quick response. Here's what I got using TERMSTR=CRLF on
Windows, a similar thing happened on UNIX:
10 * read cards ;
11 data ds1 ;
12 length var1 $16. ;
13 INFILE CARDS termstr = CRLF ;
-------
17
ERROR 17-123: Invalid context (INFILE CARDS) for option name TERMSTR.
14 input var1 $ ;
15 n + 1 ;
16 var1len = length(var1) ;
17 cards ;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DS1 may be incomplete. When this step was
stopped there were 0
observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds
-- TMK --
"The Macro Klutz"
On Mon, 19 May 2008 09:21:25 -0500, data _null_, <datanull@GMAIL.COM>
wrote:
>TERMSTR=
>controls the end of line/record delimiters in PC and UNIX formatted
>files. This option enables the sharing of UNIX and PC formatted files
>between the two hosts. The following are values for the TERMSTR=
>option:
>
>CRLF Carriage Return Line Feed. This parameter is used to read PC format
files.
>
>NL Newline. This parameter is used to read UNIX format files. NL is the
default.
>
>
>Use TERMSTR=CRLF to read a file that was created on the PC. If this PC
>format file was created using TERMSTR=NL, then the TERMSTR option is
>unnecessary.
>
>
>
>On 5/19/08, Talbot Michael Katz <topkatz@msn.com> wrote:
>> Hi.
>>
>> I have code that needs to run on both Windows and UNIX platforms. If I
>> have a data step created in Windows that reads in data lines as follows:
>>
>> data ds1 ;
>> length var1 $16. ;
>> INFILE CARDS ;
>> input var1 $ ;
>> n + 1 ;
>> var1len = length(var1) ;
>> cards ;
>> potatoes
>> CABBAGE
>> Beans
>> ;
>> run ;
>>
>> then running in UNIX sees an extra character at the end (and the
>> corresponding lengths are all one bigger). Is there a way to modify the
>> infile and / or input statements and / or system options (and / or
>> something else) so that the code still works the same way in Windows,
and
>> works the same way in UNIX as it does in Windows? Do I have to use a
>> macro that tests &sysscp or &sysscpl ? (If so, what's the most
efficient
>> way?)
>>
>> Thanks!
>>
>> -- TMK --
>> "The Macro Klutz"
>>