BookmarkSubscribeRSS Feed
joycehyj1109
Calcite | Level 5

I tried to import  Simplified Chinese rtf files with following code, but the all simplified Chinese word will become like below.

Is there any method that I could get the simplified Chinese word?

 

 

filename rtf "xxxxxxxxxxxxxxxxxx\&output..rtf";

 

data rtf_input;
infile rtf
delimiter='00'x MISSOVER DSD lrecl=32767
firstobs=1;
format f1 $500.;

input

f1 $ ; 
run;

 

sas.png

 

 

4 REPLIES 4
ballardw
Super User

Since RTF is not intended for data interchange I wish you lots of luck with this project.

 

I would recommend to try saving the file to plain text format so most of the RTF code tags go away. That might make reading the file a lot simplier.

 

What do you mean by "simplified Chinese word"?

mkeintz
PROC Star

I am totally unfamiliar with these issues, so this question might be wholly naïve: have you set session encoding, and filename encoding?

 

See 16355 - Does SAS support UTF-16 encoding?.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ChrisNZ
Tourmaline | Level 20

I looked at the third character 分 (the easiest to identify to my western eyes).

According to https://www.yellowbridge.com/chinese/charsearch.php?zi=%E5%88%86

The document seems to use gb2312 encoding.

I am unsure that SAS supports it. If not, you'll have to transcode to UTF (and use a UTF SAS session).

So you'll have to read the value B7D6 and transform it to U+5206.

 

 

woshibug
Fluorite | Level 6

you'll have to read the value B7D6 and transform it to U+5206. As you mention,how could I transform B7D6 to U+5206?

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 967 views
  • 0 likes
  • 5 in conversation