DATA Step, Macro, Functions and more

Some character data was lost during transcoding in the dataset

Reply
Occasional Contributor
Posts: 14

Some character data was lost during transcoding in the dataset

Hi All,


While creating the table into oracle database by PROC SQL/Data step statement i'm getting "-" symbol got converted into "–" special character. Can anyone please suggest how to prevent the conversion.


Original Data is in SAS datasets is : "Infections - Viral Hepatitis - New or worsening"

After loading data into Oracle database it will become "Infections - Viral Hepatitis – New or worsening"


Currently i'm using INENCODING=ANY OUTENCODING=ANY options with Libname statement.


When using INENCODING='UTF-8' OUTENCODING='UTF-8' options with libname then getting below error..


SAS Studio
ERROR: Some character data was lost during transcoding in the dataset TEST. Either the data contains characters that are not
representable in the new encoding or truncation occurred during transcoding.

Thank you in advance.

Valued Guide
Posts: 556

Re: Some character data was lost during transcoding in the dataset

[ Edited ]
Posted in reply to singhsahab

Did you check what encoding is your SAS and Oracle.

 

For SAS run: proc options option=encoding; run;

For Oracle run : select * from nls_database_parameters where parameter = 'NLS_CHARACTERSET';

 

 Make sure you have the right encoding for both.

Thanks,
Suryakiran
Occasional Contributor
Posts: 14

Re: Some character data was lost during transcoding in the dataset

Posted in reply to SuryaKiran

Hi Surya,

 

Thank you for your suggestion. I check and found my SAS 9.4 default encoding is "WLATIN1" and my oracle DB default encoding UTF-8.

Can you please suggest how to convert encoding WLATIN1 to UTF-8 . i used outencoding options with libname statement but getting the same error as earlier. 

 

Please let me know if any other suggestion to pervert the conversion.

 

Many Thanks,

A.K 

Valued Guide
Posts: 514

Re: Some character data was lost during transcoding in the dataset

Posted in reply to singhsahab

Some chars in UTF-8 can't be converted to WLatin1, those chars are causing the trouble. Imho changing the encoding of the sas session is the only way to solve the issue. Session encoding can only be changed in the sas servers config files.

Valued Guide
Posts: 556

Re: Some character data was lost during transcoding in the dataset

Posted in reply to singhsahab

You might have the UTF-8 PC SAS, Open Windows>All Progrms>SAS>SAS unicode uft8. Open this and work from here. 

 

Also these might help:

http://support.sas.com/kb/51/586.html

http://support.sas.com/kb/15/597.html

Thanks,
Suryakiran
Super User
Posts: 10,679

Re: Some character data was lost during transcoding in the dataset

Posted in reply to singhsahab

Make SAS and Oracle has the same encoding.

Check sasenv_local file .

 

OR

OUTENCODING='WLATIN1' 

 

WLATIN1 is your sas encoding. use this code check:

proc options option=encoding;run;

Ask a Question
Discussion stats
  • 5 replies
  • 77 views
  • 0 likes
  • 4 in conversation