Desktop productivity for business analysts and programmers

Transcoding Problem

Reply
Occasional Contributor
Posts: 19

Transcoding Problem

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

Trusted Advisor
Posts: 1,051

Re: Transcoding Problem

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

Valued Guide
Posts: 3,206

Re: Transcoding Problem

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 --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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.

Valued Guide
Posts: 3,206

Re: Transcoding Problem

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 --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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

Grand Advisor
Posts: 9,571

Re: Transcoding Problem

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

Valued Guide
Posts: 3,206

Re: Transcoding Problem

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 --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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?

Valued Guide
Posts: 3,206

Re: Transcoding Problem

Copy it back to your original location....

---->-- ja karman --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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.

Valued Guide
Posts: 3,206

Re: Transcoding Problem

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 --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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;

Valued Guide
Posts: 3,206

Re: Transcoding Problem

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 --<-----
Occasional Contributor
Posts: 19

Re: Transcoding Problem

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

Ask a Question
Discussion stats
  • 27 replies
  • 1978 views
  • 3 likes
  • 6 in conversation