BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can I export SAS 9.1 data to a Custom XML File using XMLMap as opposed to TAGSET Template?

Can I export SAS Datasets to a Custom XML file by using DTD or XSL ?
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
In SAS 9.1 you can only IMPORT from XML data to SAS dataset using an XMLMap. I belive that in SAS 9.2, you can also EXPORT from XML to SAS using an XMLMAP.

I do not believe either version allows the use of import/export via DTD or XML Schema (XSD).

Since an XSL file can transform from one form of XML to another form, it is possible that you could use SAS to export your DATA to the SAS-default XML format and then write your own XSL transform from the SAS default XML structure to your desired structure. There are several 3rd party XML tools that will read a DTD or an XSD (XML Schema) and write the transform for you. SAS does not generally use an XSL method -- the SAS XMLMAP uses more XPath-like syntax for creating your SAS dataset from XML.

Capabilities for the 9.2 XML engine are described here:
http://support.sas.com/documentation/cdl/en/engxml/59528/HTML/default/engxmlwhatsnew902.htm

That page describes the mechanism for EXPORTing via XMLMAP:

You can now export an XML document from a SAS data set using the XMLMap that was created to import the XML document. The XMLMap tells the XML engine how to map the SAS format (variables and observations) into the specific XML document structure.


A specific example of exporting using SAS 9.2 is here:
http://support.sas.com/documentation/cdl/en/engxml/59528/HTML/default/a002593019.htm

This paper shows the use of TAGSET templates to generate custom XML files in SAS 9.1.3:
http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt24.pdf
However, in SAS 9.1.3, you would still have to figure out the mapping from SAS data file to XML file. This generally works better if you have a sample XML file to work with, instead of the DTD or Schema (in my opinion).

Or, for more help, you might consider working with Tech Support.

cynthia
deleted_user
Not applicable
Hi Cynthia,

I really appreciate your detailed explanation. You are correct. I was able to import from XML to SAS dataset using XMLMap. I have to export SAS data to complicated mortgage related (MISMO standard) XML file. I will try TAGSETS template.

Thanks
MR

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 691 views
  • 0 likes
  • 2 in conversation