BookmarkSubscribeRSS Feed

The TERMSTR option is used to define the record delimiter (End of record marker) on flat files.

This options does not accept hex values, which is very odd as record delimiters normally aren't standard characters.

The syntax   TERMSTR='0c'x   should be supported.

The example above was chosen because '0c'x is often used by Hadoop files.

 

As an aside, this whole option could do with a cleanup as in the following example,

 

data t;
  file "%sysfunc(pathname(work))/t.txt" termstr='0c'x;
  put 'A' / 'B' / 'C' ;
run;
data _null_; infile "%sysfunc(pathname(work))/t.txt" termstr='0c'; input; putlog _infile_; run;

1- The x is suffix ignored in the first data step's file statement and the delimiter is set to string '0c'.

  So the file is 9 bytes long and contains: 

  A0cB0cC0c

 

2- In the second data step, SAS somehow finds these 2 nonsensical records:

    A0cB
  C0cB

 

 

 

2 Comments
ballardw
Super User

And with the proliferation of character encoding possibly even some way to deal with double-byte character sets and unicode charcters as they may make more sense for some specific (likely poorly crafted) files.

Peter_L
Quartz | Level 8

Just make SAS grammar consistent. TERMSTR=<string> and <string> is a string expression. This kind of thing is what makes SAS so hard to learn and frightens away new users.