- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have a request from the sponsor to create XML file. They provided sample XML and XMLMAP files. XML generation was new to me so I searched online, but it seemed that XMLMAP was used more often for importing XML. I also tried the method from the post http://support.sas.com/kb/47/349.html but got an error message.
Code to create XML:
filename xmlmap "/sasdata/un0101/projects/&clnt/&pcn/&task/&mode/rawdata/test.xml";
filename map "/sasdata/un0101/projects/&clnt/&pcn/&task/&mode/rawdata/map.map";
libname xmlmap xml92 xmltype=xmlmap xmlmap=map;
data xmlmap.ODM;
set ODM;
run;
Error Message:
ERROR: The data set name 'ODM' does not match any name= attribute in the TABLE elements of the XMLMap file.
Screenshot of XMLMAP structure.
Is there anything wrong I did? Can anyone help me on creating XML file with XMLMAP?
Thanks,
Yangyin
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this link:
You can also simply write it out using PUT statements. Quick pseudocode:
data _null_ ;
file 'c:\temp\test.xml' ;
set ds ;
put '<tag>' value '</tag>'
/ '<tag2>' value2 '</tag2>';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
By anychance did you mean to use xmlv2 instead of xml92 on the libname statemen?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for getting back to me.
It is a great catch! However, I still got the same error after updating to xmlv2. I honestly don't understand the syntax to generate XML with XMLMAP, and I am not sure if the data step is correct (ODM is the first table in XMLMAP).
data xmlmap.ODM;
set ODM;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply! I changed to xmlv2 but still did not work for this special case. I ended up with PUT statements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this link:
You can also simply write it out using PUT statements. Quick pseudocode:
data _null_ ;
file 'c:\temp\test.xml' ;
set ds ;
put '<tag>' value '</tag>'
/ '<tag2>' value2 '</tag2>';
run;