I'm trying to import xml-file to SAS. Xml-file is a Google "georesponse" on address request. Here's its fragment: <address_component> <long_name>1025</long_name> <short_name>1025</short_name> <type>street_number</type> </address_component> <address_component> <long_name>Gilford Street</long_name> <short_name>Gilford St</short_name> <type>route</type> </address_component> <address_component> <long_name>West End</long_name> <short_name>West End</short_name> <type>neighborhood</type> <type>political</type> </address_component> <address_component> <long_name>Vancouver</long_name> <short_name>Vancouver</short_name> <type>locality</type> <type>political</type> </address_component> I've attached the full xml-file. I want to convert it into SAS-dataset like this: type long_name street_number 1025 route Gilford St neighborhood West End etc As you can see, some <address_component>-elements have inside only one <type>-element (like street_number or route), but others have two: first one with value of interest (e.g. 'neighborhood') and the second - with value 'political', which I don't need. So I created XML-map in XML Mapper, using function POSITION()=1, to ensure that only first occurence of <type>-tag used: <?xml version="1.0" encoding="windows-1252"?> <!-- ############################################################ --> <!-- 2014-01-03T17:07:57 --> <!-- SAS XML Libname Engine Map --> <!-- Generated by XML Mapper, 903000.0.0.20110518190000_v930 --> <!-- ############################################################ --> <!-- ### Validation report ### --> <!-- ############################################################ --> <!-- XMLMap validation completed successfully. --> <!-- ############################################################ --> <SXLEMAP description="Google Georesponse" name="GeocodeResponse" version="2.1"> <NAMESPACES count="0"/> <!-- ############################################################ --> <TABLE name="GeoResponse"> <TABLE-PATH syntax="XPath">/GeocodeResponse/result/address_component</TABLE-PATH> <COLUMN name="type"> <PATH syntax="XPath">/GeocodeResponse/result/address_component/type[position()=1]</PATH> <TYPE>character</TYPE> <DATATYPE>string</DATATYPE> <LENGTH>27</LENGTH> </COLUMN> <COLUMN name="long_name"> <PATH syntax="XPath">/GeocodeResponse/result/address_component/long_name</PATH> <TYPE>character</TYPE> <DATATYPE>string</DATATYPE> <LENGTH>17</LENGTH> </COLUMN> </TABLE> </SXLEMAP> And it works properly in XML Mapper itself (in the tab Table View you can see the expected values). But when I run the code using this map in SAS EG 4.3 or SAS Base 9.3, column 'type' is empty. If I don't use POSITION()=1 in the map, then everything works well (but for all items except strett_number, route and postal_code I've got 'political' as type, not 'city', 'country' etc). I use this code for checking: filename gilfordl 'R:\gilfordl.xml'; filename SXLEMAP 'R:\georesponsemap.map'; libname gilfordl xmlv2 xmlmap=SXLEMAP access=READONLY; DATA GeoResponse; SET gilfordl.GeoResponse; run; When tried the same with XML Mapper 9.2 (and verison of SXLEMAP 1.2 ) and SAS 9.2 everything works perfectly. But not with SAS 9.3. For the latter I tried to change version of SXLEMAP to 1.2 in the map-file and to use XML engine instead of XMLV2, but still no luck - type is empty. But as soon as I delete position()=1, everything works. Does anybody have any clue where can a problem be? Some SAS 9.3 specific?
... View more