<?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: Converting accented letters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468337#M285424</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
x=basechar("àáâäãåçéèêëîïìíô");
put x=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Jun 2018 12:30:45 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-06-07T12:30:45Z</dc:date>
    <item>
      <title>Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468220#M285421</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Annually, I process a large dataset with 7 name fields; some of the names have accented characters, e.g., Aarón.&amp;nbsp; I posted here about 4 years ago and found the solution (thank you all!) of using the translate function to replace the accented characters with “normal” letters:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  array seven {7} $ mfirsta mmiddlea mlasta bfirsta bmiddlea blasta dlasta;
  array eight {7} $ mfirst mmiddle mlast bfirst bmiddle blast dlast;
  do k=1 to dim(seven);
    eight{k}=upcase(translate(seven{k},"aaaaaaceeeeiiiiooooouuuun","àáâäãåçéèêëîïìíôòóõöùúûüñ"));
    end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not run the program last year; this year it won’t work.&amp;nbsp; When SAS (this year is SAS 9; not sure what it was before) reads in the data it replaces the accented characters with little “boxes” before the translate code can take effect.&amp;nbsp; Searching the community help forums I found the tranwrd function, which helped but as a previous poster noted replaced the accented characters with a blank space.&amp;nbsp; Per other suggestions, I converted the raw data file to utf8, and eventually found that the following works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  array seven {7} $ mfirsta mmiddlea mlasta bfirsta bmiddlea blasta dlasta;
  array eight {7} $ mfirst mmiddle mlast bfirst bmiddle blast dlast;
  ...
  array eighteen {7} $ mfirst mmiddle mlast bfirst bmiddle blast dlast;
  array nineteen {7} $ mfirst mmiddle mlast bfirst bmiddle blast dlast;
  do k=1 to dim(seven);
    eight{k}=tranwrd(seven{k},"à","a");
    nine{k}=tranwrd(eight{k},"á","a");
	...
    seventeen{k}=tranwrd(sixteen{k},"ù","u");
    eighteen{k}=tranwrd(seventeen{k},"ú","u");
    nineteen{k}=tranwrd(eighteen{k},"ñ","n");
    end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, this is pretty clunky, and only covers half of the 25 accented characters in the original code.&amp;nbsp; There must be a more streamlined method?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 23:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468220#M285421</guid>
      <dc:creator>DebbiBJ</dc:creator>
      <dc:date>2018-06-06T23:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468232#M285422</link>
      <description>&lt;P&gt;What encoding is your SAS session and your dataset? Those little "boxes" might be because your session and dataset have different encodings.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="codeFragment"&gt;/* Find SAS session encoding */&lt;BR /&gt;proc options option=encoding;    
run; &lt;BR /&gt;/* or */&lt;BR /&gt;&lt;BR /&gt;%PUT %SYSFUNC(getOption(ENCODING));&lt;BR /&gt;&lt;BR /&gt;/* Find SAS dataset encoding */&lt;BR /&gt;%LET DSID=%SYSFUNC(open(sashelp.class,i)); /* sashelp.class dataset, replace with your dataset */
%PUT %SYSFUNC(ATTRC(&amp;amp;DSID,ENCODING));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Converting SAS dataset encoding might help TRANSLATE to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/15/597.html" target="_blank"&gt;http://support.sas.com/kb/15/597.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 02:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468232#M285422</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-06-07T02:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468241#M285423</link>
      <description>&lt;P&gt;I missed something.&lt;/P&gt;
&lt;P&gt;If &lt;FONT face="courier new,courier"&gt;tranwrd&lt;/FONT&gt;() works after conversion then surely &lt;FONT face="courier new,courier"&gt;translate&lt;/FONT&gt;() works?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 03:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468241#M285423</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-07T03:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468337#M285424</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
x=basechar("àáâäãåçéèêëîïìíô");
put x=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jun 2018 12:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468337#M285424</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-07T12:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468380#M285425</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28685"&gt;@DebbiBJ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You've got code that used to work but doesn't anymore. It used to work with an older version of SAS but now with a newer one doesn't anymore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;'s question about the session encoding points likely into the right direction. It's very possible that your newer version of SAS now uses a different encoding - eventually UTF-8 which uses more than one byte to store certain characters (and though it's called MBCS - MultiByteCharacterSet). It's also rather likely that your older SAS version used single byte encoding (SBCS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If above is true then yes, TRANSLATE() won't work anymore for characters encoded with more than one Byte (MBCS). You need to use function KTRANSLATE() instead.&lt;BR /&gt;That things still work for you using TRANWRD() is a pointer that this is the problem as TRANWRD() works for MBCS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below link provides a table which shows you for all the string functions where you can use them (SBCS only or also MBCS).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&amp;nbsp;" target="_blank"&gt;http://documentation.sas.com/?docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 19:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468380#M285425</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-12T19:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468457#M285426</link>
      <description>&lt;P&gt;ktranslate worked!&amp;nbsp; (Well, once I switched the order of accented vs. non-accented back from the reversed order that tranwrd uses...)&lt;/P&gt;
&lt;P&gt;I had seen ktranslate in the help documentation but couldn't "translate" all the details into making sense to me.&lt;/P&gt;
&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468457#M285426</guid>
      <dc:creator>DebbiBJ</dc:creator>
      <dc:date>2018-06-07T17:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468539#M285427</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Nice one, never seen that function before.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;Any chance you could mention to someone suitable that the online doc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=titlepage.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=titlepage.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is incomplete and misses functions like qscan() or basechar() ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 21:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/468539#M285427</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-07T21:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/469700#M285428</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I just wanted to supply you with the links the docs for these 2 functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%QSCAN is in the macro doc:&lt;/P&gt;&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p0mnb8dwzghn9cn1cokdgg9xixg6.htm" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p0mnb8dwzghn9cn1cokdgg9xixg6.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BASECHAR is in the National Language Support doc&lt;BR /&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p078j5y1bbc9xfn1scp11kw3nmnt.htm" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p078j5y1bbc9xfn1scp11kw3nmnt.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the programming Help Center link if you'd like to start your search from here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=pgmmvaov&amp;amp;docsetTarget=pgmsasov.htm" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=pgmmvaov&amp;amp;docsetTarget=pgmsasov.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here are a couple of tips to help you find the doc.&lt;/P&gt;&lt;P&gt;If you're in the Functions doc, there is a topic &lt;EM&gt;SAS Functions and CALL Routines Documented in Other SAS Publications&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;It's at the top of the Dictionary section of the doc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0yxrrjwf22bkun1lyoi5oxueh6w.htm" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0yxrrjwf22bkun1lyoi5oxueh6w.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And, If you haven't found it yet, the programming Help Center Syntax Quick links can get you to the list of all of the functions.&lt;/P&gt;&lt;P&gt;From the programming Help Center link above, select Syntax Quick Links &amp;gt; SAS Language Elements by Name, Product, and Category. Scroll down to Functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, the quickest way is to search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Eliz.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 18:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/469700#M285428</guid>
      <dc:creator>elizD</dc:creator>
      <dc:date>2018-06-12T18:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Converting accented letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/469714#M285429</link>
      <description>Thank you!&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jun 2018 19:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-accented-letters/m-p/469714#M285429</guid>
      <dc:creator>DebbiBJ</dc:creator>
      <dc:date>2018-06-12T19:03:15Z</dc:date>
    </item>
  </channel>
</rss>

