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.
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
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: