11-11-2015 08:13 AM
I have a SAS code text file which when read into the previous 9.3 (32bit) SAS system showed as fine, but now we have upgraded to 9.4 (64bit), shows and odd character encoding. It happens particularly on the £ symbol. When loaded via SAS file open, shows a filled triangle, but in notepad, and if I copy paste from notepad it shows the pound correctly. I have checked, the underlying hex code is A3, which is fine, even if I save from notepad, then load that it doesn't seem to recognise that character. Its odd, might happen with others, this is the only one I have found. Example:
"�" - loaded directly into SAS 9.4 64bit
"£" - pasted in from notepad
11-11-2015 08:35 AM - edited 11-11-2015 08:35 AM
Display manager is still not caught up with handling UTF-8 encoding. So even if you are running SAS with encoding set to UTF-8 you might not be able to see those extended character codes in Display Manger. Reading the values into variables and printing them using ODS destinations such as HTML or PDF should work fine.
Are you trying to view these characters in the Program Editor window (or the Enhanced Program Editor window if you are running SAS on a Windows PC)?
11-11-2015 08:39 AM
Yes, sorry, I should have been clearer on this. I am loading the SAS text file into the enhanced editor - it is part of the SAS code not data which is causing this, rest of code is:
ods escapechar="�"; /* when loaded directly into SAS 9.4 64bit */
ods escapechar="£"; /* when copied and pasted in from notepad */
If it waas an extended or special character then I could understand this, however it is the pound symbol, a base table character, so it should not have any trouble with it. The same file loaded in 9.3 32bit did not have any problems with the file, and it showed correctly, has only come about after the move to 9.4 64bit.
11-11-2015 09:06 AM - edited 11-11-2015 09:10 AM
Most likely they have setup using different encoding and/or country setting. My PC-SAS installation has both a normal American English version and a Unicode version. They show different codes for those two characters.
I will paste logs below, but I suspect that this site will also cause some character translations. Look at the hexcodes that are printed by the $HEX. format. If you really want to use a particular character as an escape character then you can code it as a literal using the quoted hex code followed by the letter x. So you could try using 'A3'x if that is the character that is in your data.
* "Normal" SAS ; 87 data _null_; 88 x1="?"; 89 x2="£"; 90 put x1= $quote. +1 x1 $hex.; 91 put x2= $quote. +1 x2 $hex.; 92 run; x1="?" 3F x2="£" A3
* Unicode support ; 13 data _null_; 14 x1="ï¿½"; 15 x2="Â£"; 16 put x1= $quote. +1 x1 $hex.; 17 put x2= $quote. +1 x2 $hex.; 18 run; x1="ï¿½" EFBFBD x2="Â£" C2A3
11-11-2015 09:11 AM
Yes, its likely to be a setup issue. I ran the same code and get:
data _null_; x1="�"; x2="£"; put x1= $quote. +1 x1 $hex.; put x2= $quote. +1 x2 $hex.; run; 9 data _null_; 10 x1="ï¿½"; 11 x2="Â£"; 12 put x1= $quote. +1 x1 $hex.; 13 put x2= $quote. +1 x2 $hex.; 14 run; x1="ï¿½" EFBFBD x2="Â£" C2A3 NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Thanks for your help Tom, I will send this back to the people who installed the new version.