Cornell University Cornell University CISER

CISER Computing

How to read an XML data file using the SAS XMLMapper

If you have an XML data file that you want to convert into SAS, use the SAS XMLMapper. You must have the SAS XMLMapper installed in your system.

Here are the steps for using the SAS XMLMapper:

  1. Click Start>All Programs>SAS>SAS XMLMapper
  2. Click File>Open XML, select the XML file you want to convert to SAS, then click OK
  3. If a window pops up and say "File size is larger than recommended" just click Yes to Continue
  4. In the upper left toolbar, click the button "Automatically generate an XMLMAP from the XML Structure" (located 6th from the left)
  5. At the bottom panel, click the XMLMAP tab, highlight the entire text inside the tab, copy it, then paste in Notepad.
  6. Save the notepad file. Give it any name, but make sure the extension name is .map . Also take note where you saved the . map file.
  7. Back to SAS XMLMAP, at the bottom panel click on the SAS Code Example tab.
  8. In the SAS Code Example tab.
    1. Check only the PROC Datasets box so the code will not show the other procedures.
    2. Copy all the codes in the tab, and paste it in a SAS Enhanced Editor
  9. After pasting the code in the SAS Enhanced Editor, edit the code. Replace the <mapName>.map in the FILENAME SXLEMAP statement with the complete path and filename of the .map file you saved earlier. Make sure the path and filename are enclosed in quotes.
  10. Then submit the SAS code.
  11. Then view the SAS datasets created to see if they contain the variables you expected and run some frequency and contents procedures.
  12. Check all the datasets created by the above steps because of the message(s) in Step 3.