<?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 several special characters in the same value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73369#M15803</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for your suggestions - they both give me the desired results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Helle</description>
    <pubDate>Tue, 21 Sep 2010 06:59:53 GMT</pubDate>
    <dc:creator>Helle</dc:creator>
    <dc:date>2010-09-21T06:59:53Z</dc:date>
    <item>
      <title>Converting several special characters in the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73366#M15800</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a dataset containing the variable "memname". The values of "memname" may contain one or more Danish characters like Æ, Ø and Å. I need to convert these to AE, OE and AA respectively. The new converted values are stored in the variable "memname_dk". Examples of values with Danish characters include "ÅRSOPGØRELSE" and "ANSØGT_VILKÅR".&lt;BR /&gt;
&lt;BR /&gt;
I have tried to use different loops to make sure that all Danish characters are converted but didn't succeed yet so in the end I decided to simply run three almost identical data steps (see below). However, I am sure there must be a more simple way to do this. Can anybody help me please?&lt;BR /&gt;
&lt;BR /&gt;
Here's the current solution: &lt;BR /&gt;
data aa;&lt;BR /&gt;
	set aa;&lt;BR /&gt;
	memname_dk=memname;&lt;BR /&gt;
	if find(memname_dk,'Æ') &amp;gt; 0 then memname_dk=tranwrd(memname,'Æ','AE');&lt;BR /&gt;
run;&lt;BR /&gt;
data aa;&lt;BR /&gt;
	set aa&lt;BR /&gt;
	if find(memname_dk,'Ø') &amp;gt; 0 then memname_dk=tranwrd(memname,'Ø','OE');&lt;BR /&gt;
run;&lt;BR /&gt;
data aa;&lt;BR /&gt;
	set aa&lt;BR /&gt;
	if find(memname_dk,'Å') &amp;gt; 0 then memname_dk=tranwrd(memname,'Å','AA');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Helle</description>
      <pubDate>Mon, 20 Sep 2010 13:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73366#M15800</guid>
      <dc:creator>Helle</dc:creator>
      <dc:date>2010-09-20T13:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting several special characters in the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73367#M15801</link>
      <description>did you try embedding the tranwrd functions?&lt;BR /&gt;
data dealt_with ;&lt;BR /&gt;
set original ;&lt;BR /&gt;
memname_dk=&lt;BR /&gt;
tranwrd(&lt;BR /&gt;
tranwrd(&lt;BR /&gt;
tranwrd(memname&lt;BR /&gt;
,'Æ','AE')&lt;BR /&gt;
,'Ø','OE')&lt;BR /&gt;
,'Å','AA');&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 20 Sep 2010 14:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73367#M15801</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-09-20T14:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting several special characters in the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73368#M15802</link>
      <description>First, your design is slightly flawed, since it does not handle strings that contain a combination of these danish characters.&lt;BR /&gt;
&lt;BR /&gt;
Second, there's no need to spread the function call over three data steps.&lt;BR /&gt;
Third, there's no actual need for an "if" test.&lt;BR /&gt;
&lt;BR /&gt;
Just chain the tranword function calls/statements like in e.g.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data aa ;&lt;BR /&gt;
  set aa ;&lt;BR /&gt;
  memname_dk = tranwrd(memname,'Æ','AE');&lt;BR /&gt;
  memname_dk = tranwrd(memname_dk,'Ø','OE');&lt;BR /&gt;
  memname_dk = tranwrd(memname_dk,'Å','AA');&lt;BR /&gt;
run ;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 20 Sep 2010 14:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73368#M15802</guid>
      <dc:creator>Robert_Bardos</dc:creator>
      <dc:date>2010-09-20T14:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Converting several special characters in the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73369#M15803</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for your suggestions - they both give me the desired results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Helle</description>
      <pubDate>Tue, 21 Sep 2010 06:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-several-special-characters-in-the-same-value/m-p/73369#M15803</guid>
      <dc:creator>Helle</dc:creator>
      <dc:date>2010-09-21T06:59:53Z</dc:date>
    </item>
  </channel>
</rss>

