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.
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.
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?
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?
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:
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.
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:
In one of the links you provided, there was a macro which effortlessly did my job!
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.
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.
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.