07-15-2016 01:23 PM - edited 07-15-2016 01:26 PM
I got a question through Private Message and I'm proud to say I'm stumped :-) The person is trying to import an XML dataset into SAS UE, and I thought for sure that the Import Data Task would have XML as an option - nope, no such luck. I found the following code in this paper:
libname myxml xml 'U:\XML\subjects.xml'; libname dat 'U:\data\'; data dat.subjects; set myxml.subjects; run; proc print data = dat.subjects noobs; run;
I'm running a Mac, so changed the two libname statement to the Mac format /Users/.../myfolders/ . SAS successfully connected, and looked like it imported the data but the dataset was empty and I had no other information in the log.
I know and have started using XML Mapper for work, but unfortunately there's no version of it for the Mac. If anyone knows a way to import data into UE (with or without XML Mapper), I'd appreciate it.
I've tried attaching the XML file I was using, but it appears to be removed when i post the message. The one I was using was from the Pubmed database and is one of their "sample" files for testing APIs, so I assume it's in proper form.
Thanks so much for your time,
07-16-2016 10:22 AM
XML must be all over the web. As an alternative to PROC COPY, you can use the DATA step, especially if you have any manipulation that needs to be done. More complicated structures will need to have an XML Map, but a simple structure, such as I show in the screen shot, the XML Libname Engine should work.
see the screen shot posted here: https://communities.sas.com/t5/Base-SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284023#M5...
Need further help from the community? Please ask a new question.