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

Hi masters!

 

I'm trying to read an XML from an external URL, the code that i use is like this:

 

filename Archive url 'https://myURL?$format=xml'
User="USER" pass="PASS";
filename SXLEMAP 'C:\mapa.map';
libname Archive xml92 xmlmap=SXLEMAP access=readonly;

 

Well this code works properly and I have tables in the library but when I try to filter the table with a query i get the error:

 

ERROR: Some code points did not transcode.
occurred at or near line 1, column 954035
ERROR: XML parsing error. Please verify that the XML content is well-formed.

 

I create the map file with SAS XML mapper and the automatic option.

 

Kind regards

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Might be an encoding mismatch.  If you can use UTF-8 encoding in your SAS session, you might have better luck.  Or take a look at the XML file (the column where the error was flagged) and see if it's an aberration -- something like a curly quote or some other character that really shouldn't be there.  I'd use Notepad++ for something like that.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

7 REPLIES 7
ChrisHemedinger
Community Manager

Instead of running queries directly on the XML libname, I'd use DATA step to create a copy as a SAS data set.  Then run your filter on that.

 

data myxml;
  set Archive.myxml;
run;
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
JuanDaniel
Quartz | Level 8

Thanks @ChrisHemedinger

 

But i tried with the data step and I get the same error.

 

Kind regards

ChrisHemedinger
Community Manager

Might be an encoding mismatch.  If you can use UTF-8 encoding in your SAS session, you might have better luck.  Or take a look at the XML file (the column where the error was flagged) and see if it's an aberration -- something like a curly quote or some other character that really shouldn't be there.  I'd use Notepad++ for something like that.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
JuanDaniel
Quartz | Level 8

@ChrisHemedinger How can i use the UTF-8 in my SAS session?

 

I think i dont have 954035 colunms :S

 

Kind regards

ChrisHemedinger
Community Manager

I suspect that your XML file is being read as a huge 1-line mass, and the column number is really a character position.  That's why I suggested Notepad++ -- it can handle large files and you can navigate to the 954,035th character position, see what's there.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
JuanDaniel
Quartz | Level 8

@ChrisHemedinger

 

The change for use the encoding UTF-8 in the file sasv9.cfg affects to all sessions, there is any way to force only one project to UTF-8 encoding or for only one dataset?

 

Kind Regards

 

JuanDaniel
Quartz | Level 8

Thanks!! @ChrisHemedinger

 

I change the encoding for the SAS session and it works!!!

 

Kind regards

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 7 replies
  • 2865 views
  • 1 like
  • 2 in conversation