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
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];
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
What did you see when you ran PROC PRINT on the data set?
What system encoding is your SAS session using? Run this statement to check.
%put %sysfunc(getoption(encoding));
You can also get encoding information from PROC OPTIONS. Run
proc options option=encoding value;
run;
I am running WLATIN1. -Cristian
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.
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;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.