BookmarkSubscribeRSS Feed
stataddict
Calcite | Level 5

Hi all,

I have a question about encoding in sas. Im doing some project and i need to do it in Cyrillic.

I have not yet got the full data, but i was experimenting with the following code:

data x (encoding='wcyrillic');

length str $20;

str = 'уникод';

run;

Or

data x (encoding=wcyrillic);

length str $20;

str = 'уникод';

run;

Both codes give an error.

Please help, how to solve such issues.

Thank you!

5 REPLIES 5
jakarman
Barite | Level 11

You must use a dbcs installation option of SAS using/supporting Unicode. Most installations are done in the single-byte approach thinking in the world of latin1  (only English like languages with several code-pages).

Eguide is supporting utf8 at the client-side you can type the code as you have shown, the sas process could be limited to latin1.  Analytics-u is supporting utf8 in the SAS session.

Remember utf8 is a variable way of encoding characters it can be really challenging for oldies. See: SAS(R) 9.4 National Language Support (NLS): Reference Guide, Second Edition
See the note about I18N level2 functions. The old single-byte thinking is problematic.

You can store your SAS code on the OS as usual but it will get a bom-marker (byte-order marker) indicating the utf8 usage.
Not all other tools are able to work with that. Some/many SAS config files must be old fashioned  Ascii.  A tool like notepad++ can help you with files at that level.        

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

Is it possible to make such changes in one time sas session and return to the defaults after i quit SAS?

It is one time small project, and i guess, i will not need Cyrillic in near future.

Here is the output from

proc options group=languagecontrol; run;

Group=LANGUAGECONTROL

DATESTYLE=MDY     Identify sequence of month, day and year when ANYDATE informat data is

                   ambiguous

DFLANG=ENGLISH    Language for EURDF date/time formats and informats

NOLOCALELANGCHG   Do not change the language of SAS message text in ODS output when the

                   LOCALE option is specified

PAPERSIZE=LETTER  Size of paper to print on

RSASIOTRANSERROR  Display a transcoding error when illegal data values for a remote

                   application

TRANTAB=(lat1lat1,lat1lat1,wlt1_ucs,wlt1_lcs,wlt1_ccl,,,)

                   Names of translate tables

URLENCODING=SESSION

                   Specifies URL percent encoding for the URLENCODE and URLDECODE functions

NODBCS            Do not process double byte character sets

DBCSLANG=NONE     Specifies the double-byte character set (DBCS) language to use

DBCSTYPE=NONE     Specifies a double-byte character set (DBCS) encoding method

ENCODING=WLATIN1  Specifies default encoding for internal processing of data

LOCALE=EN_US      Specifies the current locale for the SAS session

NONLSCOMPATMODE   Uses the user specified encoding to process character data

jakarman
Barite | Level 11

I do not see your SAS version/release or Windows/Unix environment. In both cases when the installation has done with all language support options.
There is a technical part you can switch between those different language versions.
It is not only Cyrillic but all languages. With the Utf8 version of a SAS session you should be able to process them all.
Why back to the Hollerith approach?  For some limitations (like manframes do not support utf8) you need both options.
  

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

It is Windows Operating System:   WX64_WKS.

SAS version 9.3.

It seems complicated to use Cyrillic in SAS Smiley Sad

jakarman
Barite | Level 11

With Windows you can check the map: bit version of SAS). in this map you should find those nls folders like "en" English and "u8".
When your installation is missing that "u8" the person installing SAS did not set the selection utf8 /dbcs/ button for that, while installing SAS.

In the u8 folder you will find a sasv9.cfg file. This is the one when activated will run SAS in "u8" mode. The default sasv9.cfg in 9.3 folder is just a pointer to the "en" version.

Knowing this it should be very easy to have those different encoding session being get to run.
It is not that very complicated.

The real complication is understanding utf8 in the first place. 

---->-- ja karman --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 3957 views
  • 0 likes
  • 2 in conversation