<?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: Spelling correction in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559850#M156402</link>
    <description>&lt;P&gt;Thank you very much for your valuable advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;</description>
    <pubDate>Sat, 18 May 2019 06:31:57 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2019-05-18T06:31:57Z</dc:date>
    <item>
      <title>Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559574#M156274</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I want to spelling correction in existing data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data trns;&lt;/P&gt;&lt;P&gt;x='JAPON';&lt;/P&gt;&lt;P&gt;m=translate('x','O','A');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 07:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559574#M156274</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-05-17T07:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559583#M156277</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;I want to spelling correction in existing data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data trns;&lt;/P&gt;
&lt;P&gt;x='JAPON';&lt;/P&gt;
&lt;P&gt;m=translate('x','O','A');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You already have working code. Where is the problem?&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 08:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559583#M156277</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-17T08:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559597#M156284</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are not translating the &lt;U&gt;value of variable X&lt;/U&gt;, but the &lt;U&gt;literal string 'x'&lt;/U&gt;, because you have the variable name in quotes, so the translate function does not see it as a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And remember the translate function has the arguments reversed compared to human logic:&amp;nbsp;Translate(Variable, TO, FROM), so you get JOPON, where I guess you would want JAPAN. - The Tranwrd function has the arguments in logic order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this, you get JAPAN in both new variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trns;
	x='JAPON';
	m=translate(x,'A','O');
	n=tranwrd(x,'O','A');
run;&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 09:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559597#M156284</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-05-17T09:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559601#M156287</link>
      <description>&lt;P&gt;Thank your very much for your support&amp;nbsp;&lt;/P&gt;&lt;P&gt;what if multiple spelling corrections in existing data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data mulspell;&lt;BR /&gt;input country$12.;&lt;BR /&gt;datalines;&lt;BR /&gt;Australia&lt;BR /&gt;Newzelandd&lt;BR /&gt;Garmany&lt;BR /&gt;wasington&lt;BR /&gt;netherlands&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Regards, ANAND</description>
      <pubDate>Fri, 17 May 2019 09:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559601#M156287</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-05-17T09:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559727#M156357</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Corrections with string functions will be impossible, because a translation that works for one name will ruin another. I do the following, which is very useful if it is a production job:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Make a table with all distinct names selected from source and sorted by name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.Export the list to excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Open the spreadsheet, write the correct name in column B and copy it down to all different occurrences of the same country. Note that each country should have a row with the correct name in col. A. - Save.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Read the spreadsheet into a SAS table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Left Join the source table and the correction table on country.&amp;nbsp;Now all names found in the correction table will be translated,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;6. Make a table with distinct names where corrected_name = ''.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;7. If this table has zero rows, everything is OK. Otherwise you have new countries or new misspellings in your input. Add the names to your spreadsheet and rerun 4-7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 17:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559727#M156357</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-05-17T17:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Spelling correction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559850#M156402</link>
      <description>&lt;P&gt;Thank you very much for your valuable advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2019 06:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Spelling-correction/m-p/559850#M156402</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-05-18T06:31:57Z</dc:date>
    </item>
  </channel>
</rss>

