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

I have a Oracle table in which some columns are in Russian. I need to import the Oracle table in a SAS dataset and convert all these columns into English. What's the best way to go about this? Also what would be the encoding type. It would really help if you can let me know the exact syntax.

Some values are a mixture of English & Russian, so the code should work for those too.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Cool! I saw the macro in the link to the paper.You've now taught me how to do it too. That is the beauty of the SAS Community.

 

Please mark the post as answered. 

 

View solution in original post

9 REPLIES 9
SASKiwi
PROC Star

SAS doesn't do language translations so you really have two basic choices. One is to use a translation app like Google Translate, the other is to send your data off to be translated by a company or person doing translation services.

 

Regarding the encoding, what does the Russian text look like when you import it now? Does it display correctly or not? 

abhik_giri
Calcite | Level 5

I do not think using Google translate is a good idea as there are thousands of strings in Russian.

 

After importing, the Russian text looks like "¿¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿ ¿¿¿¿. ¿¿¿¿¿¿-¿¿-¿¿¿¿" (series of inverted question marks, often separated by space or dash). Different strings have different number of question marks/space/dash. Position of space and dash also vary. Is it possible to convert these to English using some intelligent SAS option?

 

SASKiwi
PROC Star

OK so you have encoding issues. If you changed the encoding setup in SAS to display the Cyrilic characters correctly that is all SAS can do. It isn't going to translate Russian into English.

 

I'm not an expert in this area but this link might be helpful:

 

http://support.sas.com/documentation/cdl/en/nlsref/67964/HTML/default/viewer.htm#n1d2i07lune0dxn1bsa...

 

 

abhik_giri
Calcite | Level 5

Thanks a lot!

Looks like encoding value for Cyrilic is wcyrillic.

Another problem is I'm trying to import the dataset from Oracle DB into SAS using the following syntax:

libname ... oracle user=... password='...' path=...; run;

How do I fit encoding="wcyrillic" option here?

 

Thanks again for your guidance.

SASKiwi
PROC Star

No problem. I've done a bit more searching and found this:

 

http://support.sas.com/resources/papers/Multilingual_Computing_with_SAS_94.pdf

 

Also this SAS note explains how to query the Oracle encoding:

 

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

 

and this shows you how to set the NLS_LANG setting for Oracle:

 

http://support.sas.com/kb/18/688.html

abhik_giri
Calcite | Level 5

 

In one of the links you provided, there was a macro which effortlessly did my job! 

SASKiwi
PROC Star

Cool! I saw the macro in the link to the paper.You've now taught me how to do it too. That is the beauty of the SAS Community.

 

Please mark the post as answered. 

 

abhik_giri
Calcite | Level 5

One weird thing is that the macro generates correct output only when it is run twice. First time, it generates incorrect characters, but second time, it generates correct values for the Russian characters! I replicated the occassions multiple times, restarted SAS and my computer itself, but the result remains same. Not that this is a roadblock, but was curious to know why SAS is behaving so strangely.

Tom
Super User Tom
Super User

I didn't look at your particular macro, but that type if situation is usually caused by assigning a value to a macro variable within the macro without first defining its scope.  So you run the macro and it creates some local macro variable that disappears when the macro ends. Later in your code you create some global macro variable with the same name.  Then the second time you run it the macro will use the global macro variable and viola! you can see the results.

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!

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
  • 9 replies
  • 3340 views
  • 1 like
  • 3 in conversation