Actually, it is not a paper .
I just want share an idea and SAS code to somebody who need it in the future.
Sometimes, I received a SAS dataset which encoding is utf-8,
but my running sas session is euc-cn encoding.
When I opened it and it get messy and unreadable characters .
Like this :
I tried
data want(encoding=any);
set have;
run;
and
libname x cvp 'c:\temp' cvpmult=2;
proc copy in=x out=work noclone;
run;
but still can't get job done.
Finally I found an workaround way to conquer this obstacle .
My basic idea is first change utf-8 dataset into utf-8 csv file and import these csv file into euc-cn encoding sas .
1) copy " UTF8_SAS.sas " and " Chinese_SAS.sas " into the fold which contains the utf-8 encoding sas datasets. (Check attachment)
Like this :
2) Open utf-8 encoding SAS . and running sas code " UTF8_SAS.sas " under it .
Like this :
3) Open Chinese SAS (euc-cn encoding). and running sas code " Chinese_SAS.sas " under it .
Like this :
4) and could get a fold named SAS under the same fold .
Like this :
5) the sas datasets under SAS fold are what I want.
i.e. the sas datasets under SAS fold have encoding 'euc-cn' .
6) Open these sas datasets under SAS fold could get the right Chinese characters .
P.S. this way also could work on Japanese or Korean SAS dataset which encoding is utf-8.
Hi Xia, @Ksharp Requesting to add more comments to make little more comprehensive when and if you have time and at your own convenience. Thank you.
Do you have any questions ? You would meet Chinese characters in your routine work ?
Oh Not really. However, A friend of mine who is Chinese or I guess Chinese-Singaporean works for Standard Chartered in Singapore. I often talk to him about you and he follows your solutions closely. So yeah, he uses chinese characters in his routine work. Therefore, I make it a point to make him aware of any new major contributions you make. 🙂
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.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.