Hi all,
I use SAS Studio and have the problem with encoding of sas dataset.
data dt;
set inlib.dt;
run;
I get the error and 0 row in work.dt dataset.
%let dsn=inlib.dt;
%let dsid=%sysfunc(open(&dsn,i));
%let encoding=%sysfunc(attrc(&dsid,encoding)).;
%let rc=%sysfunc(close(&dsid));
%put The encoding for data set &dsn is: &encoding.;
%put The SAS session encoding is: &sysencoding.;
%let dsn=inlib.dt;
%let dsid=%sysfunc(open(&dsn,i));
NOTE: Data file INLIB.DT.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance.
WARNING: Some character data was lost during transcoding in the dataset INLIB.DT. Either the data contains characters that are not representable in the new encoding or truncation occurred during transcoding.
%let encoding=%sysfunc(attrc(&dsid,encoding)).;
%let rc=%sysfunc(close(&dsid));
%put The encoding for data set &dsn is: &encoding.;
The encoding for data set inlib.dt is: utf-8 Unicode (UTF-8).
%put The SAS session encoding is: &sysencoding.;
The SAS session encoding is: utf-8
So either the creator of the dataset provided invalid UTF-8 bytes in the file.
Or the other issue mentioned in the error message is happening. Is the file corrupted?
So either the creator of the dataset provided invalid UTF-8 bytes in the file.
Or the other issue mentioned in the error message is happening. Is the file corrupted?
I think you are right about invalid UTF-8 bytes in the file.
I try with other dataset. And it's okay.
The first dataset doesn't seem corrupted because I can open it in SAS Studio and can use "proc print".
So, I think the problem is decided 🙂 Need the new correct dataset.
Thanks.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.