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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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