BookmarkSubscribeRSS Feed
agreekgod
Calcite | Level 5

Hello guys,

When I merge a particular dataset, Organization2014, in SAS with others I continually come up with the same error regarding transcoding. I have been able to find that this datase is in Wlatin1 format, but I don't know how I can convert it so that it could be merged with the other datasets. Below is a screenshot of the error if it is any use. Thank for taking your time to read the question, I really appreciate i

27 REPLIES 27
TomKari
Onyx | Level 15

I don't know if this will apply to you, but at my former organization I had a simple rule. When someone called, and mentioned an error that included the word "transcoding", I would reply that they had copied text out of Microsoft Word and tried to use it in SAS. There are a number of features, like smart quotes, where Word introduces characters that cause default SAS to burp.

If this applies to you, take a look at your data for things like slanted quotes, unusual dashes, and special characters. They could be the problem.

Tom

jakarman
Barite | Level 11

Where is the screenshot?

I think the correct word is encoding when your are about NLS SAS(R) 9.4 National Language Support (NLS): Reference Guide, Third Edition

If you look at that you will find even Wlatin1 is used in different charactersets/encodings. 
Your messages is indicating a difference has been marked so the process of transcoding will try to correct the differences

The most modern encoding used with internet (html)  and office is utf8. This encoding is of variable length 1-4 bytes and you need a run-time version of SAS to handle that. Eguide however (.NET) is always utf8.

Another common message is foreign native format. That is about CEDA Moving and Accessing SAS(R) 9.4 Files, Second Edition.

Originally it was aprt of SAS/connect (SAS v6) but move to base as a generic approach. The cause of this is not having the SAS-datasets being processed by the current version. SAS is weird to common RDBMs approaches allowing cross ref versions machine layout to be read and created.

You should think of sas-datasets / tables as they are RDBMS like an not drag/drop using the files-tab of Eguide or Windows explorer.

Use the SAS explorer and libnames to access data. 

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

SAS Screenshot of Best Salesperson Error.jpgHere is the screenshot. On the dataset I am using there are some special characters that must be the problem, I just don't know how to avoid the error though.

jakarman
Barite | Level 11

That screen is showing a lot:

- You have Eguide that is UTF-8
- There is that CEDA message in the top, The data is coming from a different SAS releases/machines.
- The transcoding message is a result of having different encodings and different SAS releases/machines.

- It is a student/teachers Eguide  approach that was the common approach SAS offered until a year ago. You are working on the Orion dataset.

What has happened is that your teacher did an upload from his system to the educations environment and it was a different version or afterwards the version/release did change. When your teacher wil do a fresh copy may be just using this environment the data is updated to the current native one and the message will disappear.

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

Thanks for your information Jaap.Unfortunately my teacher is not going to release another fresh copy of the data set. Is there anyway I could fix it manually? Thanks

Ksharp
Super User

Change your dataset into a CSV file in UTF-8

filename .......   encoding='utf8';

proc export ...

and import it back in your SAS .

proc import ..........

Xia Keshan

jakarman
Barite | Level 11

If you can copy the dataset to another location (thatn one is having the message) and use that copied version, the message will be gone.

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

The dataset with the error is connected to a lot of other further datasets that I have created and if I delete the original one then it will affect many other things in my process flow. Is there a way around this?

jakarman
Barite | Level 11

Copy it back to your original location....

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

I have tried to copy the dataset out using this code:

proc append base=ORION.neworganization2014 data=ORION.organization2014;

run; 

However, I am still receiving the same error:

ERROR: Some character data was lost during transcoding in the dataset ORION.ORGANIZATION2014. Either the data contains characters

       that are not representable in the new encoding or truncation occurred during transcoding.

jakarman
Barite | Level 11

Than rename those datasets and use the new one. Every time you are using the old one the message will pop-pup the new one is converted and should not give any conversions note anymore. Why not using proc copy with the noclone option?  

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

How do I use proc copy exactly? I have looked online but it is hard to understand by me with very limited computer/coding skill.This is an example, is this the right code?

LIBNAME inlib cvp 'SAS-library';

LIBNAME outlib 'SAS-library' outencoding=”encoding value for output”;

proc copy noclone in=inlib out=outlib;

  select car;

run;

jakarman
Barite | Level 11

Base SAS(R) 9.4 Procedures Guide, Third Edition

LIBNAME inlib    '/?/??? '    ;   /* put in the physical location where the data is now */

LIBNAME outlib '/?/??? '    ;   /* put in the physical location where the data should copy to */i

proc copy  in=inlib out=outlib   noclone;

  /* selection is not needed when copying all */

run;

Use the new physical location in your old code using the old libname ref.  See example 3 and the syntax.

---->-- ja karman --<-----
agreekgod
Calcite | Level 5

I have inserted this code:

LIBNAME inlib   '/home/zclchjh/sasuser.v94/all_SASDATA/';  

LIBNAME outlib '/home/zclchjh/sasuser.v94/all_excel'    ;  

proc copy  in=inlib out=outlib   noclone;

select organization2014.sas7bdat

I am expecting that the datset organization2014 ends up all_excel but that hasn't happened

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 27 replies
  • 5133 views
  • 3 likes
  • 6 in conversation