BookmarkSubscribeRSS Feed
Seb_Royer
Calcite | Level 5

I need to create an xml file which conforms to the attached xml file, as well as adhering to XML v1.0 and XML Schema v1.0.

I have no experience with xml and am hoping that someone who has that experience can comment on whether this is achievable. 

I have installed SAS XML Mapper as I believe it will be required to generate an XML map file to be used to create an output file. 

 

Other info;

Using SAS 9.3 on AIX.

Currently I am writing output as a .csv file using a file statement in a data step.

Some variables are null in the source dataset, I'm not sure how this affects the XML output. 

2 REPLIES 2
AlanC
Barite | Level 11

I use XML daily (and I use JSON a lot, which is similar). On XML, don't get too confused: it is really 2 things, elements (<LastName>) and attributes (<Name last='Churchill'...).

 

Which one to use is 100% in the hands of the person reading it. Hence, anyone can write whatever they want in those tags and anyone can interpret the tags as they see fit. XML is the easiest thing out there but freaks people out all of the time. Once you get the simplicity, all is well. It is just the way to get info on what is being moved. Think of it as a Goodwill form. What are you donating? This object. Ok, thank you.

 

BTW. XML is probably going away (replaced by JSON but that is another story). JSON is even simpler.

 

I never use SAS for XML or JSON. I front with something like Python or C#. Solutions should be future-proofed and I prefer engines that handle XML/JSON better. Let SAS do the data/proc side but use something else for dealing with hierarchical values. XMLMAP Is most likely C++ behind the scenes so roll your own, IMO.

 

The C# or Python is probably 5 lines of code so it is not hard.

 

 

https://github.com/savian-net
RyanK
Obsidian | Level 7
An XML map can only be used to create an XML file from a single dataset. If you import into multiple datasets, you will need to create your export process.

Hopefully the SAS XML facility to add functionality, but until then you are on your own.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1058 views
  • 0 likes
  • 3 in conversation