Statistical programming, matrix languages, and more

Unicode within IML

Reply
Contributor
Posts: 21

Unicode within IML

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

SAS Super FREQ
Posts: 3,837

Re: Unicode within IML

Posted in reply to crisgugiu

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];
Contributor
Posts: 21

Re: Unicode within IML

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

SAS Super FREQ
Posts: 3,837

Re: Unicode within IML

Posted in reply to crisgugiu

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

Super User
Super User
Posts: 7,255

Re: Unicode within IML

Posted in reply to crisgugiu

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

%put %sysfunc(getoption(encoding));
SAS Super FREQ
Posts: 3,837

Re: Unicode within IML

You can also get encoding information from PROC OPTIONS. Run

proc options option=encoding value; 
run;
Contributor
Posts: 21

Re: Unicode within IML

I am running WLATIN1. -Cristian

SAS Super FREQ
Posts: 3,837

Re: Unicode within IML

Posted in reply to crisgugiu

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.

Super User
Posts: 10,205

Re: Unicode within IML

Posted in reply to crisgugiu
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;




Ask a Question
Discussion stats
  • 8 replies
  • 342 views
  • 0 likes
  • 4 in conversation