I am working on a dataset I got from a colleague in sas7bdat file format. When I tried to read in the file I get that it is in a format native to the host. And then an error that character data was lost in transcoding. So I lose my total number of observations. Attaching screenshots, would appreciate any help. Thank you!
Code:
libname SAMBA "/folders/myfolders/SAMBA";
Data work.pcorifinal;
set SAMBA.pcorifinal;
Run
That is to say your SAS encoding is not matched with your colleague's .
Here are options:
1) Let your colleague to make that sas table as a utf-8 encoding.
2)use PROC CPORT + PROC CIMPORT to transform that sas table.
3)Try CVP engine:
libname x cvp '/folders/myfolders/SAMBA';
proc copy in=x out=work noclone;
run;
4) Let your colleague offer you a CSV or TXT file, instead of a sas table .
Take a look at: https://communities.sas.com/t5/General-SAS-Programming/Data-file-is-in-a-format-that-is-native-to-an...
Art, CEO, AnalystFinder.com
Hi,
Thanks for sharing that. I actually referenced that post before and tried it. I'm still getting the same error message of truncating results and losing number of observations. Do you know if there are other solutions? Or would having them send it in another file format and importing/converting it in possibly solve this issue? I'm not sure if it might be associated with SAS University? Thanks!
A couple of additional possibilities are mentioned in the thread at: https://communities.sas.com/t5/General-SAS-Programming/Transcoding-problem/td-p/390028
Art, CEO, AnalystFinder.com
Of course this might help to identify which encoding was used: https://documentation.sas.com/?docsetId=viyadatamig&docsetTarget=n0l8h0a2hkxa7cn1a8jwkcilok2z.htm&do...
Art, CEO, AnalystFinder.com
Try:
data work.pcorifinal(encoding='UTF-8');
set SAMBA.pcorifinal;
run;
Report the result of:
proc contents data=SAMBA.pcorifinal;
run;
That is to say your SAS encoding is not matched with your colleague's .
Here are options:
1) Let your colleague to make that sas table as a utf-8 encoding.
2)use PROC CPORT + PROC CIMPORT to transform that sas table.
3)Try CVP engine:
libname x cvp '/folders/myfolders/SAMBA';
proc copy in=x out=work noclone;
run;
4) Let your colleague offer you a CSV or TXT file, instead of a sas table .
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.