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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 654 views
  • 0 likes
  • 3 in conversation