07-12-2016 11:00 PM
07-12-2016 11:45 PM
Thank you for your SAS code! KSharp
I had tried your code by using real XML file. There is no syntax error! That is good! But only 3 out of 4000 line data imported . Here is my output:
affordability_ORDINAL calculatedTotalAnnualGrossRental amount1
1 1 26000
2 2 13000
3 3 13000
My XML file would have multiple layout - it could be deep in 7 layers. It used "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Have you got SAS code to coping with much more complexed XML file please (ie: real world XML file not academic XML file)?
07-13-2016 07:42 PM
I can only open XML in Excel as a read-only workbook. Please find the attached sample TXT file. Since I could not post the attachment as XML file, so I saved it in TXT file, you need NotePad++ to convert to XML file.
Please note the data in XML is artifical data not real values. Just to illustrate the XML data structure.
Please let me know if this is doable or not.
07-13-2016 09:22 AM
The SAS dataset that you import will not maintain the hierarchical structure of your original XML file. Remember that a SAS dataset is a data structure composed of rows and columns, so every row or observation has the same number of columns.
On the other hand, with an XML definition, you could have one structure where the <WOMBAT> element was optional. But SAS does not have the possibility of optional columns. Every row will have the same number of columns -- some of the columns may have missing values on some rows, but the way that it works with importing XML into SAS data format is that your XML elements are turned into SAS columns. There's a very simple example of a non-hierarchical XML file shown in the screen shot below.
Need further help from the community? Please ask a new question.