<?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: Removing non Unicode characters from a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343316#M78811</link>
    <description>&lt;P&gt;The function you are going to want is TRANSLATE. The characters are more likely to be "high order ASCII" or similar which are representations of ASCII values greater than 126.&lt;/P&gt;
&lt;P&gt;The data set may help:&lt;/P&gt;
&lt;PRE&gt;data work.highorderascii;
   do i= 127 to 255;
      char = byte(i);
      output;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;Here is an example using translate function that may work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x='Andrè';
   y=translate(x,'AAAAAAACEEEEIIIIDNOOOOO OUUUUY Saaaaaaaceeeeiiiidnooooo ouuuuy y',
                 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ');
run;&lt;/PRE&gt;
&lt;P&gt;The value in the first long string replaces the corresponding value in the second string, which is why I show them one over the other above. The comparison is case sensitive and I have used what I believe to be the common replace for most of those going into English. If you need a different rule it should be easy to manipulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 15:16:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-03-22T15:16:50Z</dc:date>
    <item>
      <title>Removing non Unicode characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343298#M78806</link>
      <description>&lt;P&gt;Hello Everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The title might not be accurate since I am not familiar with encoding, but here is my problem in simple words: I have a variable which is actually a list of names of people. Apparently, some of these names are Spanish or French, so they have characters which I belive are called "hexadecimal characters", such as &amp;nbsp;E with an accent above it, or a&amp;nbsp;&lt;SPAN&gt;lowercase i with umlaut above it. ( I dont know how to type them, some examples are attached in the picture.)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to convert all of them into regular characters, for example, E with dots into E, etc.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I thought compress function should be the right way, so&amp;nbsp;first I tried to just keep the alphabets like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test2;
   set test;
   names_translate = compress(name2,'','ka');
run;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;It does not work unfortunately, and those charachters remain there. I played with other modifiers, such as 'c' or 'w' but those do not seem to give me what I want either. I was wondering if there is a neat method with compress function, or any other function that gives me the desired result? In the picture below I have shown basically what I have and what I want to get as output.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7881iF94F3EA7DD299246/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Example" title="Example" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 14:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343298#M78806</guid>
      <dc:creator>Shayan2012</dc:creator>
      <dc:date>2017-03-22T14:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Removing non Unicode characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343316#M78811</link>
      <description>&lt;P&gt;The function you are going to want is TRANSLATE. The characters are more likely to be "high order ASCII" or similar which are representations of ASCII values greater than 126.&lt;/P&gt;
&lt;P&gt;The data set may help:&lt;/P&gt;
&lt;PRE&gt;data work.highorderascii;
   do i= 127 to 255;
      char = byte(i);
      output;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;Here is an example using translate function that may work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x='Andrè';
   y=translate(x,'AAAAAAACEEEEIIIIDNOOOOO OUUUUY Saaaaaaaceeeeiiiidnooooo ouuuuy y',
                 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ');
run;&lt;/PRE&gt;
&lt;P&gt;The value in the first long string replaces the corresponding value in the second string, which is why I show them one over the other above. The comparison is case sensitive and I have used what I believe to be the common replace for most of those going into English. If you need a different rule it should be easy to manipulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343316#M78811</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-22T15:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Removing non Unicode characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343480#M78862</link>
      <description>Thanks a lot, ballardw. That is exactly what I was looking for!</description>
      <pubDate>Wed, 22 Mar 2017 19:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-non-Unicode-characters-from-a-variable/m-p/343480#M78862</guid>
      <dc:creator>Shayan2012</dc:creator>
      <dc:date>2017-03-22T19:22:49Z</dc:date>
    </item>
  </channel>
</rss>

