Hi All,
I need to import excel spreadsheets containing Hex and convert it to the Chinese language so it can then be translated. An example is I need to convert:
73B0572865B94FBF62537ED94F605417 to
现在方便打给你吗 |
Is there a way this can be done? I've googled it to death but have yet to find an answer.
Many thanks in advance
Steve
This is because the SAS session you started is most likely run with 'English' encoding and not 'Unicode.' So, while you are properly performing the encoding you are unable to store/view the unicode characters with the given session settings.
data _null_;
input foo $hex32.;
bar=unicode(foo,'utf16b');
put bar;
cards;
73B0572865B94FBF62537ED94F605417
;
run;
Hiya,
I tried your code but it doesn't appear to work:
Is it a matter of finding the correct encoding?
cheers
Steve
37 data _null_ ;
38 input foo $hex32.;
39 bar=unicode(foo,'utf16b');
40 put bar;
41 cards;
NOTE: Argument 1 to function UNICODE('s°W(e¹O¿bS~Ù'[12 of 16 characters shown],'utf16b') at line 39
column 5 is invalid.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9---
42 73B0572865B94FBF62537ED94F605417
foo=s°W(e¹O¿bS~ÙO`T bar= _ERROR_=1 _N_=1
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
44 run;
This is because the SAS session you started is most likely run with 'English' encoding and not 'Unicode.' So, while you are properly performing the encoding you are unable to store/view the unicode characters with the given session settings.
Most sas installations are done wit a single byte Latin approach. Eguide is supporting utf8 that includes Chinese chars. When running sas in utf8 mode you should change your mind that 1 char is 1 byte. There are 1 to 4 bytes representing 1 char. Your reading and conversion of chars should go automatic. The challenge is that some coding habits need to change.
Thanks for your help, I should be able to get things working from here.
I tested Matt's code . It is right . I never realize SAS has such function ,must >=9.3 .
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.