02-16-2016 10:46 AM
02-16-2016 05:36 PM
A guess and likely not the most helpful if you have many files, but open the XML in a spreadsheet program. If the data looks "good" save to a CSV and import that perhaps with datastep code to set variable names as you would like.
02-17-2016 06:22 AM
02-16-2016 09:21 PM - edited 02-16-2016 09:23 PM
Yes. Data step can do that . But that depend on how complicated the XML file is .
Or you could check xml2 engine. Like : libname x xml2 '......' automap=replace;
02-17-2016 06:15 AM
tried this soultion and sas throws an error as below,
ERROR 22-7: Invalid option name AUTOMAP.
I am using sas version 9.3 in my windows PC. does this option work for you, or is it used in some different version of SAS.
02-17-2016 05:04 PM
The AUTOMAP option was not available in the XMLV2 LIBNAME engine until the second maintenance release of SAS 9.3. Based on the error message, I suspect you are not at that maintenance level of SAS 9.3.
02-18-2016 01:57 AM
you are correct, I am using sas 9.3. Probably not that version that has auto map option.
Is there any way that I can have that enabled in the current version of SAS, is there any path that needs to be installed to enable this.
02-17-2016 02:10 AM
Sorry for the confusion,
I should have given more specific requirment.
I have zipped and attached an example XML, and this needs to be imported without an XML map.
I have to automate this in such a way that any xml file that is been provided needs to be imported without any issue.
The column names would change with different XML files.
02-17-2016 03:44 AM
OK. Here is .
libname nhl xmlv2 '/folders/myfolders/LabReviewMicroSampleData.xml' automap=replace xmlmap='/folders/myfolders/NhlGenerate.map'; proc contents data=nhl._all_ nodetails; run; proc print data=nhl.Sex;run;
02-17-2016 06:12 AM
In this solution you have used 'nhlgenerate.map' import the data form the XML file.
Is there any way that we can import the data without any XML map been created?
When I tried creating a xml map using XML automap, I getting error due to unavailability of formats and informats. Is it possible for you to share the map, that you used?
02-17-2016 08:01 PM
is genereated by SAS . You can assign it any name like x.map yy.map . No need to consider about it.
If you SAS doesn't has such ability ,try SAS University Edition.
03-01-2016 02:26 PM
As noted, the easiest way to do this is with the XMLV2 LIBNAME engine and the AUTOMAP option. By using AUTOMAP=REPLACE, the map file is regenerated each time and is specific to the XML file specified. If you don't like the idea of keeping the map file around between runs, you can automatically throw it away by using a temporary map file:
filename test 'c:\LabReviewMicroSampleData.xml'; filename tempmap temp; libname test xmlv2 xmlmap=tempmap automap=replace;
I had no problems using this method to create data sets from your posted XML file.