Hi:
The ways I know about are:
1) using the XML Libname engine with an XML Map
2) using the XML Libname engine with an XSL Schema
3) using a DATA step program
4) writing a custom tagset template
You would need to read about how the XML Libname Engine works by default and then figure out which method works best for you. Seeing a copy of the final XML is useful, but without a sample of data, to see the structure of the current SAS data set, it is hard to make any constructive suggestions.
Documentation for the XML Libname engine is here:
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/engxml/titlepage.htm and an XML Map paper is here:
https://support.sas.com/resources/papers/proceedings13/124-2013.pdf that shows the use of an XML Map for both import and export.
Cynthia