BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nigromx
Fluorite | Level 6

Hello everyone:

 

I have a question, I trying read an xml file from a webservice, all is ok until I want load result into a dataset. The problem occurrs by an accent into xml tag, by example <country>México</country>.

 

This is the code:

 

filename response '/tmp/Output.xml';
filename respmap '/tmp/Output.map';

Libname response xmlv2 xmlmap=respmap automap=replace;
Libname clmfile XMLV2 '/tmp/Output.xml' XMLMAP='/tmp/Output.map';

 

The error is:

 

ERROR: The creation of the XML Mapper file failed.
ERROR: Error in the LIBNAME statement.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
nigromx
Fluorite | Level 6

Hello everyone:

 

I can resolve the problem with this lines

 

proc soap in=<filein> out=<fileout> url=<url> soapaction=<soapaction> envelope;

 

envelop is an option of proc soap that store complete soap result in the outputfile, fileout in this case. The complete result include

 

<?xml version="1.0" encoding="iso-8859-1" ?>

 

Thanks very much.

 

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

What encoding is your SAS session using?  Run either of these lines of code to find out.

proc options option=encoding; run;
%put %sysfunc(getoption(encoding));
nigromx
Fluorite | Level 6

Hello Tom:

 

Thanks for your help the result was:

 

%put %sysfunc(getoption(encoding));
LATIN1

 

Thanks in advance.

Tom
Super User Tom
Super User

You will probably need to run SAS with unicode support so that it can handle the characters.

You might be able to just get away with adding an ENCODING=option to the filename statement that points to the XML file.

Ksharp
Super User


filename x temp;
Libname response xmlv2 '/tmp/Output.xml'   xmlmap=x   automap=replace;

proc copy in=response  out=work noclone;

run;

nigromx
Fluorite | Level 6

Hello everyone:

 

I add manually

 

<?xml version="1.0" encoding="iso-8859-1" ?>

to the out file of proc soap, and work very well. ¿proc soap can add this automatically? 

 

Thanks in advance.

nigromx
Fluorite | Level 6

Hello everyone:

 

I can resolve the problem with this lines

 

proc soap in=<filein> out=<fileout> url=<url> soapaction=<soapaction> envelope;

 

envelop is an option of proc soap that store complete soap result in the outputfile, fileout in this case. The complete result include

 

<?xml version="1.0" encoding="iso-8859-1" ?>

 

Thanks very much.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 6 replies
  • 2871 views
  • 3 likes
  • 3 in conversation