<?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 Hi Chris thanks for you reply. But I can use scan functio... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559539#M156255</link>
    <description>Hi Chris thanks for you reply.&lt;BR /&gt;&lt;BR /&gt;But I can use scan function as it is not necessary that the subcity exist in city at 1st position.&lt;BR /&gt;&lt;BR /&gt;The city string can be also like this&lt;BR /&gt;&lt;BR /&gt;Cuz ABC Alabama 80501&lt;BR /&gt;Ftt ytr ghi 80501 Alabama&lt;BR /&gt;&lt;BR /&gt;Since pattern is not consistent I used contain operator that is city contains subcity but performance of such query is very slow.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rohit&lt;BR /&gt;</description>
    <pubDate>Fri, 17 May 2019 02:59:04 GMT</pubDate>
    <dc:creator>Rohit_1990</dc:creator>
    <dc:date>2019-05-17T02:59:04Z</dc:date>
    <item>
      <title>INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559433#M156205</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have two tables&lt;BR /&gt;as follows:&lt;/P&gt;&lt;P&gt;Table A&lt;/P&gt;&lt;P&gt;City&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ZIP Code(s)&lt;BR /&gt;Alabama (AL)Huntsville&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35801&lt;BR /&gt;Alaska (AK)Anchorage&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 99501&lt;BR /&gt;Arizona (AZ)Phoenix&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;85001&lt;BR /&gt;Arkansas (AR)Little Rock&amp;nbsp; &amp;nbsp;72201&lt;BR /&gt;California (CA)Sacramento 94203&lt;BR /&gt;Los Angeles&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 90001&lt;BR /&gt;Beverly Hills&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 90209&lt;BR /&gt;Colorado (CO)Denver&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 80201&lt;BR /&gt;Conneticut (CT)Hartford&amp;nbsp; &amp;nbsp; 06101&lt;BR /&gt;Deleware (DE)Dover&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19901&lt;BR /&gt;District of Columbia&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20001&lt;/P&gt;&lt;P&gt;Table B&lt;/P&gt;&lt;P&gt;Zip&amp;nbsp; &amp;nbsp; &amp;nbsp; subcity&lt;BR /&gt;35801 alabama&lt;BR /&gt;35801 albama&lt;BR /&gt;35801 alabam&lt;BR /&gt;35801 hills1&lt;BR /&gt;35801 hills2&lt;BR /&gt;67980 hills3&lt;BR /&gt;67980 hills&lt;BR /&gt;67980 hills&lt;BR /&gt;90001 los&lt;BR /&gt;90001 albama&lt;BR /&gt;90001 rtff&lt;BR /&gt;80076 hartford&lt;BR /&gt;85001 Arizona&lt;BR /&gt;39801 alabama&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need to extract subcity from city of table A using look up within zip.&lt;/P&gt;&lt;P&gt;so that final output would be something like this&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;City&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ZIP Code(s)&amp;nbsp; &amp;nbsp; &amp;nbsp;ZIP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBcity&lt;BR /&gt;Alabama (AL)Huntsville&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35801&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35801&amp;nbsp; &amp;nbsp; &amp;nbsp; alabama&lt;BR /&gt;Alaska (AK)Anchorage&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;99501&lt;BR /&gt;Arizona (AZ)Phoenix&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 85001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;85001&amp;nbsp; &amp;nbsp; &amp;nbsp; Arizona&lt;BR /&gt;Arkansas (AR)Little Rock&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;72201&lt;BR /&gt;California (CA)Sacrament&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 94203&lt;BR /&gt;Los Angeles&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90001&amp;nbsp; &amp;nbsp; &amp;nbsp; los&lt;BR /&gt;Beverly Hills&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 90209&lt;BR /&gt;Colorado (CO)Denver&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 80201&lt;BR /&gt;Conneticut (CT)Hartford&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06101&lt;BR /&gt;Deleware (DE)Dover 19901&lt;BR /&gt;District of Columbia 20001&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have used left join using where condition of zip=ZIP Code(s)&lt;BR /&gt;AND CITY CONTAINS SUBCITY&lt;/P&gt;&lt;P&gt;BUT EXECUTION TIME IS VERY SLOW.&lt;BR /&gt;Is there any way to achieve result more efficiently?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also,can we use a fuzzy search so that we have result like this as well&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;City&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ZIP Code(s) ZIP&amp;nbsp; &amp;nbsp; SUBcity&lt;BR /&gt;Alabama (AL)Huntsville 35801&amp;nbsp; &amp;nbsp; &amp;nbsp;35801 alabama&lt;BR /&gt;Alabama (AL)Huntsville 35801&amp;nbsp; &amp;nbsp; &amp;nbsp;35801 albama&lt;BR /&gt;Alabama (AL)Huntsville 35801&amp;nbsp; &amp;nbsp; &amp;nbsp;35801 alabam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot !!!!!!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 18:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559433#M156205</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-05-16T18:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559438#M156207</link>
      <description>Other than a horrible number of misspellings, I'd suggest pulling everything to the right of ')' as the subcity.  That won't fix your *Delaware* record but handles most of the other records.</description>
      <pubDate>Thu, 16 May 2019 18:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559438#M156207</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-05-16T18:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559442#M156209</link>
      <description>&lt;P&gt;Thanks for your response .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The part displayed as part in example has data in certain pattern where' ( 'can be used to delimit .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But This is not the actual data as actual data does not has any fixed pattern and somehow I need to first index my subcity in city within a zip and if condition holds true then need to pull out subcity.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 18:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559442#M156209</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-05-16T18:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559461#M156216</link>
      <description>&lt;P&gt;It would probably help to have the entire Proc SQL code you attempted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your "execution is very slow" might be improved by coding changes but need to see the whole thing you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example it seems likely your choice of "&amp;nbsp;where condition of zip=ZIP Code(s)" might be better done as a JOIN ON of some flavor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 19:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559461#M156216</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-16T19:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559465#M156218</link>
      <description>Are the spelling issues in your actual data then?&lt;BR /&gt;&lt;BR /&gt;There's several different versions of Alabama in there. If so I would say, first clean up Table 2. Then use it as a look up to table 1, via zip. You can then find the state name and remove that from the text. You also want to remove the (ST) or the state abbreviation and you'll be left with the city name. If you just merged on zip wouldn't you get the results indicated though? So not sure what more you may need here.</description>
      <pubDate>Thu, 16 May 2019 19:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559465#M156218</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-16T19:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559472#M156220</link>
      <description>Yes spelling variations is present in data itself ,if it is a challenge to capture variations it can be left out but is there a way to capture exact matches.&lt;BR /&gt;&lt;BR /&gt;Simply put I need to check subcity string in city string based on zip .</description>
      <pubDate>Thu, 16 May 2019 20:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559472#M156220</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-05-16T20:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559531#M156249</link>
      <description>&lt;P&gt;1. Merging on equality (equi-joins) is the fastest you can merge. If that's not fast enough you need to presort the tables.&lt;/P&gt;
&lt;P&gt;2. As soon as you do fuzzy joins, performance plummets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the course of action would be:&lt;/P&gt;
&lt;P&gt;1. Sort the tables by ZIP&lt;/P&gt;
&lt;P&gt;2. Merge on ZIP equality and SUBCITY equal to the start of city (use &lt;FONT face="courier new,courier"&gt;scan()&lt;/FONT&gt; for the first word if long enough&amp;nbsp; &amp;nbsp;or&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;scan()&lt;/FONT&gt; using the parentheses as delimiter&amp;nbsp; or&amp;nbsp; operator&amp;nbsp; =:&amp;nbsp; ,&amp;nbsp; or all these successively)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. What's hasn't been matched can be retried with other criteria including fuzzy ones, like using the function &lt;FONT face="courier new,courier"&gt;compged()&lt;/FONT&gt; . The cost get higher but the volumes get smaller.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 02:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559531#M156249</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-17T02:25:25Z</dc:date>
    </item>
    <item>
      <title>Hi Chris thanks for you reply. But I can use scan functio...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559539#M156255</link>
      <description>Hi Chris thanks for you reply.&lt;BR /&gt;&lt;BR /&gt;But I can use scan function as it is not necessary that the subcity exist in city at 1st position.&lt;BR /&gt;&lt;BR /&gt;The city string can be also like this&lt;BR /&gt;&lt;BR /&gt;Cuz ABC Alabama 80501&lt;BR /&gt;Ftt ytr ghi 80501 Alabama&lt;BR /&gt;&lt;BR /&gt;Since pattern is not consistent I used contain operator that is city contains subcity but performance of such query is very slow.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rohit&lt;BR /&gt;</description>
      <pubDate>Fri, 17 May 2019 02:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559539#M156255</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-05-17T02:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Hi Chris thanks for you reply. But I can use scan functio...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559551#M156260</link>
      <description>&lt;P&gt;You missed the essence of my reply:&lt;/P&gt;
&lt;P&gt;To speed up the matches AND increase the match rate, perform successive matches rather than try to do it all in one go.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 03:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559551#M156260</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-17T03:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559716#M156351</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;Can you please elaborate more on how to carry out successive matches. It would be of great help.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 17 May 2019 16:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559716#M156351</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-05-17T16:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: INDEX of a substring in as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559979#M156455</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Can you please elaborate more on how to carry out successive matches.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not too sure whats unclear.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;So the course of action would be:&lt;/P&gt;
&lt;P&gt;1. Sort the tables by ZIP&lt;/P&gt;
&lt;P&gt;2. Merge on ZIP equality and SUBCITY equal to the start of city (use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;scan()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for the first word if long enough&amp;nbsp; &amp;nbsp;or&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;scan()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;using the parentheses as delimiter&amp;nbsp; or&amp;nbsp; operator&amp;nbsp; =:&amp;nbsp; ,&amp;nbsp; or all these successively)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. What's hasn't been matched can be retried with other criteria including fuzzy ones, like using the function&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;compged()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;. The cost get higher but the volumes get smaller.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;1. Join the easily found matches using an obvious criterion like ZIP equality and SUBCITY = first word&amp;nbsp; =&amp;gt; function scan()&lt;/P&gt;
&lt;P&gt;2. Join the&amp;nbsp;unmatched data on a less direct criterion like ZIP equality and SUBCITY = any word&amp;nbsp; &amp;nbsp; &amp;nbsp;=&amp;gt; function index()&lt;/P&gt;
&lt;P&gt;3. Repeat the process for unmatched data until satisfied: the volume to match goes down as the criterion increases in fuzziness.&lt;/P&gt;
&lt;P&gt;4. When finished, append the successive matches. It is a good idea to keep track of the match method so the data includes some sort of match-quality score.&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2019 21:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEX-of-a-substring-in-as-string/m-p/559979#M156455</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-19T21:58:42Z</dc:date>
    </item>
  </channel>
</rss>

