BookmarkSubscribeRSS Feed
shl007
Obsidian | Level 7

Hi - I've imported an XML successfully, but now I'm getting the following error when I try to use that imported XML into a data step. Any ideas? It says line 1 column 1.

 

ERROR: Expected an XML document prolog or element.

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  I don't understand, exactly how you imported the XML successfully. If you've imported the XML into a SAS data set, then you would not be getting XML errors. Or, you could be encountering an issue such as the one described here: https://support.sas.com/kb/46/233.html . I'd recommend opening a track with Tech Support. Without seeing the ALL the code you're running and the data/file you're using, it's nearly impossible to comment.

Cynthia

shl007
Obsidian | Level 7

The code I am using is below. I did submit a ticket to SAS support, and they said, "The XML Engine does not see an prolog statement  or the opening XML tag on line 1." So I sent SAS support the first few lines of my XML file. I'm not sure what to correct.

 

Using “xml2” engine:

filename myxml '/mypath/myfile.xml' ENCODING = 'unicode';

filename mymap '/mypath/myfile_generate.map';

 

libname myxml xmlv2 automap=replace xmlmap=mymap compat=yes;  

shl007
Obsidian | Level 7

Just to clarify, the lines I just provided DO run successfully. It is my data step below that bombs with the aforesaid "prolog or element" error:


data test;
set myxml.billing;
run;

 

I can see the XML imported in my libname; it is when I try to use one of the XML tables into a data step that the error occurs.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1300 views
  • 0 likes
  • 2 in conversation