BookmarkSubscribeRSS Feed
crisgugiu
Fluorite | Level 6

Is it possible to use Unicode within a SAS IML column label? I would like to assign the Greek symbols delta and epsilon to two columns. Can anyone tell me how this can be done.

 

thanks,

 

Cristian

8 REPLIES 8
Rick_SAS
SAS Super FREQ

I'm not very experienced in this area, but I think it isn't really a question about SAS/IML. The general question is "how do you put unicode characters into a SAS string in a program editor."

 

I don't know much about encodings, but you can do an internet search for "sas wlatin1 utf-8 encoding" to learn more.

My understanding is that if you are running SAS with the encoding set to UTF-8, you can enter Unicode characters into the enhanced editor. One way to get the characters into the editor is to use the Windows Character Map utility program (CharMap.exe) to copy Unicode characters to the clipboard; then the clipboard can be pasted into the SAS Enhanced Editor.

 

The following code shows DATA step code and analogous SAS/IML code. I am not running UTF-8, so let me know if it works for you:

data A;
label x = "δ"   /* U+0384: Greek Small Letter Delta */
      y = "ε";  /* U+0385: Greek Small Letter Delta */
input x y @@;
datalines;
0.1  0.2   0.01 0.05  0.03 0.12
;

proc print data=A label; run;

proc iml;
x = {0.1  0.2,
     0.01 0.05,
     0.03 0.12};
/* copy/paste from Windows Character Map */
c = {"δ"   /* U+0384: Greek Small Letter Delta */
     "ε"}; /* U+0385: Greek Small Letter Delta */

print x[colname=c];
crisgugiu
Fluorite | Level 6

Hi Rick,

 

Thanks for your reply. I ran your IML code but this was the output I got.

 

                                                x
                                               d         e

                                             0.1       0.2
                                            0.01      0.05
                                            0.03      0.12

 

The delta and epsilon Greek letters were transformed to regular characters. Hence, I am guessing that Unicode cannot be integrated into IML. Too bad.

 

Cristian

Rick_SAS
SAS Super FREQ

What did you see when you ran PROC PRINT on the data set?

Tom
Super User Tom
Super User

What system encoding is your SAS session using?  Run this statement to check.

%put %sysfunc(getoption(encoding));
Rick_SAS
SAS Super FREQ

You can also get encoding information from PROC OPTIONS. Run

proc options option=encoding value; 
run;
crisgugiu
Fluorite | Level 6

I am running WLATIN1. -Cristian

Rick_SAS
SAS Super FREQ

Right, and in my initial response I wrote "My understanding is that if you are running SAS with the encoding set to UTF-8, you can enter Unicode characters into the enhanced editor."

 

The internet search terms that I provided will tell you how to run SAS with UTF-8 encoding.

Ksharp
Super User
I am not sure if UNICODE() could work.



proc iml;
x = {0.1  0.2,
     0.01 0.05,
     0.03 0.12};
c = {"\u8023"   
     "\u8801"}; 
cc=unicode(c); print cc;
print x[colname=cc];
quit;




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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 8 replies
  • 1288 views
  • 0 likes
  • 4 in conversation