BookmarkSubscribeRSS Feed
Ce_Wo
Calcite | Level 5
Hi Everyone,

I have been searching the net with no luck and thought i would try here.

We use some SOA services and as a result customer information is stored to an XML file in a SQL database a customer level.

i have had no joy in finding how to import multiple records from an SQL DB.

Has any one had any exprience doing this i.e pulling in multiple XML files to a single sas dataset?

Any assistance would be greatly appreciated.
2 REPLIES 2
ChrisHemedinger
Community Manager
You can use the XML library engine in SAS to read XML as data. Use SAS XML Mapper to create a map file (schema rules) for how to interpret the XML you're reading.

You'll have to do this for each XML source you're working with, and then use DATA step or SQL to merge the multiple result tables together.

Here's an example of using the XML library engine:

http://blogs.sas.com/sasdummy/index.php?/archives/55-Mining-the-VP-debate-results-according-to-Twitt...

Chris
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Ce_Wo
Calcite | Level 5
Thanks Chris - I really appreciate your reply.


The XML Map and XML libname engine is the second part of the project. I almost have this covered, the link you provided is a great help and confirms I am on the right track.

The major issue I have is the XML data is being stored into a SQL database which I access through SAS via an ODBC Connection with the XML being quite complex + more than 1024bytes + multiple XML with different mappings.

My temporary solution so far is to use the SQL pass through to call a stored procedure (with SAS macro to pass through variables needed).

The stored procedure then uses BCP to save the XML files on my network.

Then it moves on the to the second stage that you have pointed out.

I am still in the testing stage and will post the solution when i am happy with the results.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 1583 views
  • 0 likes
  • 2 in conversation