BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

There is a lot of examples how to convert an xml file into a dataset and a dataset into an xml file.

How ever, if we are interested to )convert a dataset into an xml file using a specific xml schema definition, how can we do that using SAS?

 

EX:  SAS Dataset  .... reading the xml schema definition (xsd)....then obtaining the proper xml file

 

XSD (XML Schema Definition) is a World Wide Web Consortium (W3C) recommendation that specifies how to formally describe the elements in an Extensible Markup Language (XML) document. This description can be used to verify that each item of content in a document adheres to the description of the element in which the content is to be placed. XSD

 

Look at this simple XML document called "note.xml":

<?xml version="1.0"?>
< note>
 < to>Tove</to>
 < from>Jani</from>
 < heading>Reminder</heading>
 < body>Don't forget me this weekend!</body>
< /note>
 
 
 
<?xml version="1.0"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">

< xs:element name="note">
 < xs:complexType>
   < xs:sequence>
     < xs:element name="to" type="xs:string"/>
     < xs:element name="from" type="xs:string"/>
     < xs:element name="heading" type="xs:string"/>
     < xs:element name="body" type="xs:string"/>
   < /xs:sequence>
 < /xs:complexType>
< /xs:element>

< /xs:schema>

 

Regards,

Alepage

1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1331 views
  • 0 likes
  • 2 in conversation