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>
You can get the full xml-file, entering into browser the following url:http://maps.googleapis.com/maps/api/geocode/xml?address=1025,+Gilford+Street,+Vancouver&sensor=false
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:
<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>
And it works properly in XML Mapper itself (in the tab Table View). But when I run the code using this map in SAS EG or SAS Base, 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).
Does anybody have any clue where can a problem be?