SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 70054: The filename filesrvc does not read a text file correctly under LATIN1 SAS session encoding

DetailsHotfixAboutRate It

If you use a program similar to the following to read a files object that contains a text content type (for example, text/plain or text/html) in a LATIN1 SAS session encoding, and you read the files object back in a fixed record format, the text file is not read correctly: 

proc options option=encoding;
run;

filename epCode temp;
filename srcEp filesrvc "/files/files/e4bdb952-0c6c-4821-a716-3cb52baa6373";

data _null_;
    infile srcEp length=len recfm=f _infile_=tmp;
    file epCode recfm=n;
    input;
    put tmp $varying32767. len;
run;

If you set the SAS session encoding to LATIN1, you will receive an incorrect number of records and an incorrect file Encoding= value. You could also receive an error that indicates a transcoding problem in the SAS log. The corresponding SAS log looks similar to the following: 

82   proc options option=encoding;
83   run;
    SAS (r) Proprietary Software Release V.03.05  TS1M0
 ENCODING=LATIN1   Specifies the default character-set encoding for the SAS session.
NOTE: PROCEDURE OPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
...
104  run;
NOTE: The infile SRCEP is:
      Filename=#LN00006,
      URI path=/files/files/e4bdb952-0c6c-4821-a716-3cb52baa6373,
      File Identifier=e4bdb952-0c6c-4821-a716-3cb52baa6373,
      Content Type=text/plain,
      Parent URI=/jobExecution/jobs/ec7cc5f2-d038-474c-80ec-f692a98251c2,
      Encoding=UTF-8,RECFM=F,LRECL=256,
      File Size (bytes)=4517,
      Last Modified=04Dec2019:16:39:04,
      Create Time=04Dec2019:16:39:04
NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The file EPCODE is:
      
      Filename=/opt/sas/viya/config/var/tmp/compsrv/default/0ff60388-dfe0-4fc6-830e-39f31d8c15d2/SAS_work649D0001103B_sasserver.demo
      .sas.com/#LN00116,
      Owner Name=sasdemo,Group Name=sas,
      Access Permission=-rw-r--r--,
      Last Modified=19Apr2023:15:16:12
NOTE: 5 records were read from the infile SRCEP.
NOTE: DATA statement used (Total process time):
 

If the filename filesrvc worked correctly, it should read in 18 records (4517/256=17.64), and the Encoding= value should be ISO_8859-1. Instead, it reads only in 5 records and the Encoding= value is UTF-8.

Note that you can use the following file to check the contents: /opt/sas/viya/config/var/tmp/compsrv/default/0ff60388-dfe0-4fc6-830e-39f31d8c15d2/SAS_work649D0001103B_sasserver.demo.sas.com/#LN00116. However, that file is not the same as the following file: /files/files/e4bdb952-0c6c-4821-a716-3cb52baa6373

To work around this issue, change the SAS session encoding to UTF-8.

Click the Hot Fix tab in this note for a link to instructions about accessing and applying the software update.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS Viya 3.xMicrosoft® Windows® for x643.5Viya 3.5
Linux for x643.5Viya 3.5
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.