BookmarkSubscribeRSS Feed
cm2
Calcite | Level 5 cm2
Calcite | Level 5

Hi, I have a SAS dataset with Japanese characters in the result field.  I need to export this to xml.  When I run the code the xml file has errors and does not open.  The csv file opens but the Japanese is all garbbled.  I tried the option locale=ja_JP, but that didn't seem to work.  Is there another option that I need to use? Thanks for your help!! 

 

result                                                                                     visit

死んでしまいたいと思った。死んでしまいたいと思った。           1

 

死んでしまいたいと思った。死んでしまいたいと思った。            2

 

ods _all_ close;

options orientation=landscape nodate center missing=" " nonumber locale=ja_JP;

ods tagsets.ExcelXP file="p:\Trans.xml";

title ;

ods tagsets.ExcelXP options(sheet_name="Translated_Records");

proc report data=temp.qs_raw nowindows headline headskip split='^' spacing=1 list MISSING

style(header)=[background=white font_weight=bold font_size=8pt just=left cellpadding=2]

style(column)=[background=white just=center vjust=bottom cellwidth=1in font_size=8pt];

columns result visit;

 

define result /display order=data "Result" style=[cellwidth=1in just=left font_weight=bold];

define visit /display order=data "Visit" style=[cellwidth=1in just=left font_weight=bold];

 

run;

PROC EXPORT DATA= WORK.Qs_raw

OUTFILE= "p:\Free_Text_Fields.csv"

DBMS=CSV REPLACE;

PUTNAMES=YES;

RUN;

ods tagsets.ExcelXP close;

1 REPLY 1
Ksharp
Super User

That is really odd. If your sas session is Japanese encoding, should be no problem.

or try this one .

 

filename x "p:\Trans.xml" encoding='utf8';

ods tagsets.ExcelXP file=x ............;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 633 views
  • 0 likes
  • 2 in conversation