<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loading Arrays with Multiple Dataset Values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325473#M72386</link>
    <description>&lt;P&gt;1) Post code into a code box opened with the {i} icon to preserve formatting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)This code has the potential for never ending&lt;/P&gt;
&lt;PRE&gt;   do i=1 to nobs until (found);
      do j=1 to nobs2 until(found);
          
         what_it_reads = upcase(catx(" ",(CITY_ARRAY[j]),(SUFLIST[i])));
         found=indexw(upcase(ALL_ADDRESS), upcase(catx(" ",(CITY_ARRAY[j]),(SUFLIST[i]))));
      end; /* are these end statements in the right place */
   end; /* are these end statements in the right place */
&lt;/PRE&gt;
&lt;P&gt;If the boundary of the city_array and suflist value does not fall on a WORD boundary(a character other than space at begin/end/middle&amp;nbsp;)&amp;nbsp;in All_address the result of found may be 0 for all records. You may want a simple INDEX. Of if All_address has two or more consecutive spaces in the body then your match may fail. See this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   add = " This St,NYC NYC";
   str = "NYC NYC";
   resultw = indexw(add,str);
   put resultw=;
run;&lt;/PRE&gt;
&lt;P&gt;Or this with 2 spaces&lt;/P&gt;
&lt;PRE&gt;data example;
   add = " This St NYC  NYC";
   str = "NYC NYC";
   resultw = indexw(add,str);
   put resultw=;
run;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Jan 2017 21:00:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-01-17T21:00:10Z</dc:date>
    <item>
      <title>Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325310#M72346</link>
      <description>&lt;P&gt;Evening All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue in a large piece of code where the array is not loading all values, it only creates the last possible one, meaning the rest of the array is not creating all possible values for me to match on with INDEX later on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cities1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; city_name &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char50.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;HAMBURG&lt;/P&gt;&lt;P&gt;Aleppo&lt;/P&gt;&lt;P&gt;GENEVA&lt;/P&gt;&lt;P&gt;paris&lt;/P&gt;&lt;P&gt;birmingham&lt;/P&gt;&lt;P&gt;Zurich&lt;/P&gt;&lt;P&gt;Coventry&lt;/P&gt;&lt;P&gt;SINGAPORE&lt;/P&gt;&lt;P&gt;PYONGYANG&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; suflist1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; suffix &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$char50.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;street&lt;/P&gt;&lt;P&gt;road&lt;/P&gt;&lt;P&gt;avenue&lt;/P&gt;&lt;P&gt;port&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_ARRAY (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST (&amp;amp;num_recs)$&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* load cities names into list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; to nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;SUFLIST(p)=SUFFIX;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* Build CITY_ARRAY for "City_name" */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CITY_ARRAY(p)=City_name;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT face="Courier New" size="3"&gt;name = upcase(catx(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;" "&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,(CITY_ARRAY[i]),(SUFLIST[i]))); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3"&gt;So i want Name to show me the value obviously, so it gives me evidence that all values have been considered, so i would expect to see Hamburg Street , Hamburg Road all the way down to Pyongpang Port, however all i see is the latter, whats happened to the rest of the values? What have i crucially missed off?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3"&gt;As mentioned this is part of a bigger matching process with hundreds of values in the datastes im refering too, so a workaround with each individual variable in the query is not feasible&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3"&gt;much appreciated&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325310#M72346</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-17T16:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325311#M72347</link>
      <description>&lt;P&gt;actual code where the issue is if it helps:&lt;/P&gt;&lt;P&gt;where ALL_Address is the the address fields being matched against on the LARGE99 Data set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI THE CITY MATCH works fine as it should, but the CITY Match is the pain, where i believe this array is not performing as it should...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_test_data (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref) NO_MATCH (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref) POSSIBLE_STREET (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_ARRAY (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST (&amp;amp;num_recs)$&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* load cities names into list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; to nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;SUFLIST(p)=SUFFIX;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* Build CITY_ARRAY for "City_name" */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CITY_ARRAY(p)=City_name;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* match against test data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; LARGE99_data_PREP;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=indexw(upcase(ALL_ADDRESS), upcase(catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;" "&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,(CITY_ARRAY[i]),(SUFLIST[i]))));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*ADD A MARKER TO IDENTIFY IF THERE IS A MATCH TO THE LISTED CITITES*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*RUN THROUGH THE ARRAY*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; j=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dim(CITY_array);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*CHECK AGAINST ADDRESS FIELDS FOR MATCH - IS THE CITY PART OF THE ADDRESS FIELD. USE UPPER CASE ON BOTH VARIABLES */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; indexw(upcase(ALL_ADDRESS), upcase(CITY_ARRAY[j])) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LEAVE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_test_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NO_MATCH;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POSSIBLE_STREET;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325311#M72347</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-17T16:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325336#M72352</link>
      <description>&lt;P&gt;Where are you going to get a value for &amp;amp;Num_RECS? Code will fail without a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;SET&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; SUFLIST1 point=p nobs=nobs;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SUFLIST(p)=SUFFIX;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; CITIES1 point=p nobs=nobs;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Uses the same variables for POINT AND&amp;nbsp;NOBS.&amp;nbsp;REAL bad idea to reuse variable names from different sets as are you sure which one is being used where?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;You really need to display what you think the results for this exercise are supposed to be as I suspect you are making it much more difficult than needed.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325336#M72352</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-17T16:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325340#M72354</link>
      <description>&lt;P&gt;If i understand your problem correctly,&lt;/P&gt;
&lt;P&gt;- you have different numbers of records in your Cities1 and Suflist1 datasets so you have to use two macrovariables&lt;/P&gt;
&lt;P&gt;and two variables for the nobs parameter,&lt;/P&gt;
&lt;P&gt;- you have to use nested loops to generate all possible combinations&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA cities1;
    input city_name $char50.;
	call symput("num_cities",_N_);
    datalines;
HAMBURG
Aleppo
GENEVA
paris
birmingham
Zurich
Coventry
SINGAPORE
PYONGYANG
;
run;
DATA suflist1;
    input suffix $char50.;
	call symput("num_suffixes",_N_);
    datalines;
street
road
avenue
port
;
run;
 
data test;
    array CITY_ARRAY (&amp;amp;num_cities.) $200 _temporary_;
    array SUFLIST (&amp;amp;num_suffixes.)$200 _temporary_;

    * load cities names into list;
    if _n_=1 then do;
        do p=1 to nobs;
            SET SUFLIST1 point=p nobs=nobs;
            SUFLIST(p)=SUFFIX;
		end;
		do p=1 to nobs2;
            set CITIES1 point=p nobs=nobs2;
            /* Build CITY_ARRAY for "City_name" */
            CITY_ARRAY(p)=City_name;
        end;
        do i=1 to nobs;
			do j=1 to nobs2;
	            name = upcase(catx(" ",(CITY_ARRAY[j]),(SUFLIST[i])));
				output;
			end;
        end;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325340#M72354</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-17T16:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325431#M72374</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30622"&gt;@gamotte&lt;/a&gt;&amp;nbsp;you did understand correctly and it worked as i wanted on the dummy data thankyou, great stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when applying this logic in my full code the data step is taking an age (still running as i write this), could this be because of where i have placed the end statements? or is it down to the fact that &amp;amp;numrecs is 4067 obs and &amp;amp;suf_recs is 206 obs :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end outputs will give me those where it is just&amp;nbsp;a city in the address (i.e Paris (not followed by a suffix), Those which are a street (Paris Street) and those which match neither.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This previously worked fine on the city match, and i could prxmatch a few suffixes, but 200 requires something abit more strategic...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the still running code with your logic applied,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_test_valery_data (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref) NO_MATCH (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref) POSSIBLE_STREET (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DROP&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=City_name Country ref);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/* array regex (&amp;amp;num_recs) $200 _temporary_;*/&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_ARRAY (&amp;amp;num_recs) $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST (&amp;amp;suf_recs)$&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_temporary_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* load cities names into list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; to nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SUFLIST &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;SUFLIST(p)=SUFFIX;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; p=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITIES &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;point&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=nobs2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* Build CITY_ARRAY for "City_name" */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CITY_ARRAY(p)=City_name;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* match against test data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; LARGE99_data_PREP;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* DETERMINE IF ITS A MATCH ON A STREET/ROAD/AVENUE NAME*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; (found);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; j=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; nobs2 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;until&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(found);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;what_it_reads = upcase(catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;" "&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,(CITY_ARRAY[j]),(SUFLIST[i])));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;found=indexw(upcase(ALL_ADDRESS), upcase(catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;" "&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,(CITY_ARRAY[j]),(SUFLIST[i]))));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* are these end statements in the right place */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* are these end statements in the right place */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; found &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;STREET_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*ADD A MARKER TO IDENTIFY IF THERE IS A MATCH TO THE LISTED CITITES*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*RUN THROUGH THE ARRAY*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; k=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dim(CITY_array);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*CHECK AGAINST ADDRESS FIELDS FOR MATCH - IS THE CITY PART OF THE ADDRESS FIELD. USE UPPER CASE ON BOTH VARIABLES */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; indexw(upcase(ALL_ADDRESS), upcase(CITY_ARRAY[k])) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CITY_MATCH=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LEAVE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_test_valery_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'N'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NO_MATCH;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CITY_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AND&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STREET_MATCH = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Y'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POSSIBLE_STREET;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 19:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325431#M72374</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-17T19:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325473#M72386</link>
      <description>&lt;P&gt;1) Post code into a code box opened with the {i} icon to preserve formatting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)This code has the potential for never ending&lt;/P&gt;
&lt;PRE&gt;   do i=1 to nobs until (found);
      do j=1 to nobs2 until(found);
          
         what_it_reads = upcase(catx(" ",(CITY_ARRAY[j]),(SUFLIST[i])));
         found=indexw(upcase(ALL_ADDRESS), upcase(catx(" ",(CITY_ARRAY[j]),(SUFLIST[i]))));
      end; /* are these end statements in the right place */
   end; /* are these end statements in the right place */
&lt;/PRE&gt;
&lt;P&gt;If the boundary of the city_array and suflist value does not fall on a WORD boundary(a character other than space at begin/end/middle&amp;nbsp;)&amp;nbsp;in All_address the result of found may be 0 for all records. You may want a simple INDEX. Of if All_address has two or more consecutive spaces in the body then your match may fail. See this example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   add = " This St,NYC NYC";
   str = "NYC NYC";
   resultw = indexw(add,str);
   put resultw=;
run;&lt;/PRE&gt;
&lt;P&gt;Or this with 2 spaces&lt;/P&gt;
&lt;PRE&gt;data example;
   add = " This St NYC  NYC";
   str = "NYC NYC";
   resultw = indexw(add,str);
   put resultw=;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2017 21:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325473#M72386</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-17T21:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325593#M72425</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't have to test for all possible combinations. If there is no city match then you won't have street match either.&lt;/P&gt;
&lt;P&gt;You can test the city match first and if there is a match, check the street types against the matched city :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines truncover;
input address $100.;
datalines;
10 Hamburg street Rotterdam
5 Wilhelmstrasse Hamburg
;
run;

data want;
    array CITY_ARRAY (&amp;amp;num_cities.) $200 _temporary_;
    array SUFLIST (&amp;amp;num_suffixes.)$200 _temporary_;

    * load cities names into list;
    if _n_=1 then do;
        do p=1 to nobs;
            SET SUFLIST1 point=p nobs=nobs;
            SUFLIST(p)=SUFFIX;
        end;
        do p=1 to nobs2;
            set CITIES1 point=p nobs=nobs2;
            /* Build CITY_ARRAY for "City_name" */
            CITY_ARRAY(p)=City_name;
        end;
    end;

    set test;

    CITY_MATCH="N";
    STREET_MATCH="N";

    do i=1 to nobs2;
        City=upcase(CITY_ARRAY(i));

        found=indexw(upcase(address),City);

        if (found) then do;
            CITY_MATCH="Y";

            do j=1 to nobs;
                StreetType=upcase(SUFLIST(j));

				sourceString=upcase(address);
                searchString=catx(" ",City,StreetType);

				found2=indexw(sourceString,searchString);

                put sourceString= city= streetType= searchString= found2=;

                if found2 then do;
                    STREET_MATCH="Y";
                    leave;
                end;
            end;

            leave;
        end;
    end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jan 2017 09:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325593#M72425</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-18T09:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Arrays with Multiple Dataset Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325616#M72439</link>
      <description>&lt;P&gt;AWESOME - thank you so much, this is much faster and works as intended - exactly what i was looking for&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is greatly appreciated, thank you&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 10:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-Arrays-with-Multiple-Dataset-Values/m-p/325616#M72439</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-01-18T10:16:06Z</dc:date>
    </item>
  </channel>
</rss>

