BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
FGRIGNOUX
Calcite | Level 5
Hello,
I have an XML file to import into SAS BASE.
The line to import this file are into the enclosed zip in attachment.
The error is "Some code points did not tanscode ..."
The XML is encoding in ISO-8159-1 with some HMTL caracters like &#____ as pattern;
Someone have an idea to import all line of the XML ?
Thank you for your reponse
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

The encoded values are multibyte. You need to run your SAS session in multibyte mode in order to transcode these values and write them as multibyte to a SAS table.

 

Your code as such works for me in a multibyte session. I can replicate the error you get when running SAS in single byte mode.

Patrick_0-1673268185125.png

 

Running below code will tell you what's set for your SAS session. Talk to your SAS admin/support person to get the info how to create a SAS session in multibyte mode.

proc options group=LANGUAGECONTROL;
run;

.  

View solution in original post

4 REPLIES 4
Ksharp
Super User

You could remove these &#___; before importing xml file ,  if these  &#___;  were useless.

 

data _null_;
infile "C:\temp\a\Test.xml";
file "%sysfunc(pathname(work))\Test.xml";
input;
_infile_=prxchange('s/&#\w+;//',-1,_infile_);
put _infile_;
run;


libname tempxml xmlv2 "%sysfunc(pathname(work))\Test.xml" xmlmap ="C:\temp\a\map.map"  ;

proc copy in=tempxml out=work noclone;
run;
Patrick
Opal | Level 21

The encoded values are multibyte. You need to run your SAS session in multibyte mode in order to transcode these values and write them as multibyte to a SAS table.

 

Your code as such works for me in a multibyte session. I can replicate the error you get when running SAS in single byte mode.

Patrick_0-1673268185125.png

 

Running below code will tell you what's set for your SAS session. Talk to your SAS admin/support person to get the info how to create a SAS session in multibyte mode.

proc options group=LANGUAGECONTROL;
run;

.  

Ksharp
Super User

/*
@Patrick is right.
If you were using UNICODE SAS to run code,
you would get right result.
*/

libname tempxml xmlv2 "C:\temp\x\Test.xml" xmlmap ="C:\temp\x\map.map"  ;

proc copy in=tempxml out=work noclone;
run;

Ksharp_0-1673351051604.png

 

FGRIGNOUX
Calcite | Level 5
Thank you all for your response !

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
  • 347 views
  • 0 likes
  • 3 in conversation