Hi @MariaD ,
The example XML you have posted is not valid XML, so that makes it hard to tell exactly what your issue is. However, I suspect you need an XML map. Here is a nice straightforward article on how to have SAS automatically create an XML map for you using the automap= option on the libname statement: Tips for reading XML files into SAS® software - SAS Users
There are two issues with your XML: 1) the middle two elements do not have an element name, and 2) the middle two elements do not have closing tags. Below is some example code with two possible corrections of your XML. In either case, there are two elements with the same name, and both get imported.
/* Create temporary files to use for the two XML files and the XML map */
filename xmlfile1 temp;
filename xmlfile2 temp;
filename mapfile temp;
/* Create the two XML files */
data _null_;
file xmlfile1;
put '<Op id="AA" MOD="214" ZIP="AAAA">' /
'<elementname info="122" />' /
'<elementname info="213" Cd="56" Ident="oooo" />' /
'</Op>';
run;
data _null_;
file xmlfile2;
put '<Op id="AA" MOD="214" ZIP="AAAA">' /
'<info>122</info>' /
'<info Cd="56" Ident="oooo">213</info>' /
'</Op>';
run;
/* Import the two XML files into libraries called xmlfile1 and xmlfile2 respectively */
libname xmlfile1 xmlv2 xmlmap=mapfile automap=replace;
libname xmlfile2 xmlv2 xmlmap=mapfile automap=replace;
Hope this helps!
Regards,
Joshua