SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
๐Ÿ”’ This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sathasivam
Fluorite | Level 6

Hello all, 

 

I have a dataset encoded in Latin1 and we are trying to create an XML file in UTF-8.

 

In generated XML file, a french character "รจ" is appearing as strange character (xE8)

 

Even I tried to change the dataset to UTF-8 before creating XML file, but still the strange character exists. 

 

Requesting you to help me to resolve this issue

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@sathasivam wrote:

Hi Tom,

 

Thanks for your response. Am using data set and I have already used the same in my code as below: 

 

data com;
file "C:/temp/file1.xml";

put '<?xml version="1.0" encoding="UTF-8"?>';

 

Thanks


That is just telling the future users of the resulting file to interpret the text as UTF-8. That is not going to make an difference to how SAS will write the values into the file.

data com;
  file "C:/temp/file1.xml" encoding='utf-8';
  put '<?xml version="1.0" encoding="UTF-8"?>';
  ...
run;

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

HOW did you try to create the XML file?

If you are using data step and PUT statement to write it then make sure the ENCODING option is set on the FILE or FILENAME statement.

sathasivam
Fluorite | Level 6

Hi Tom,

 

Thanks for your response. Am using data set and I have already used the same in my code as below: 

 

data com;
file "C:/temp/file1.xml";

put '<?xml version="1.0" encoding="UTF-8"?>';

 

Thanks

Tom
Super User Tom
Super User

@sathasivam wrote:

Hi Tom,

 

Thanks for your response. Am using data set and I have already used the same in my code as below: 

 

data com;
file "C:/temp/file1.xml";

put '<?xml version="1.0" encoding="UTF-8"?>';

 

Thanks


That is just telling the future users of the resulting file to interpret the text as UTF-8. That is not going to make an difference to how SAS will write the values into the file.

data com;
  file "C:/temp/file1.xml" encoding='utf-8';
  put '<?xml version="1.0" encoding="UTF-8"?>';
  ...
run;

sathasivam
Fluorite | Level 6

Thanks Tom, It's working!!!!

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2439 views
  • 0 likes
  • 2 in conversation