BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
joelee1
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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 .

View solution in original post

6 REPLIES 6
joelee1
Fluorite | Level 6

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!

art297
Opal | Level 21

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

 

ChrisNZ
Tourmaline | Level 20

Try:

data work.pcorifinal(encoding='UTF-8');
  set SAMBA.pcorifinal;
run;

Report the result of:

proc contents data=SAMBA.pcorifinal;
run;

 

Ksharp
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1508 views
  • 2 likes
  • 4 in conversation