<?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: Limitation of tranwrd function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514904#M138882</link>
    <description>&lt;P&gt;What are you actually trying to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also please look at the definitions of FINDC() and TRANWRD() as I don't think you are using either of them in an appropriate way for what I think your question might be.&amp;nbsp; FINDC() is for finding first location of any one of the characters in a list. TRANWRD() for change one string to another (as opposed to TRANSLATE() that changes individual characters), but does not really understand the concept of a word despite its name.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Nov 2018 19:19:36 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-11-20T19:19:36Z</dc:date>
    <item>
      <title>Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514844#M138866</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have got the below data step:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nn;
input email :$20.;
list = catx(';','Juke@hotmail', 'Frida@gmail');
if findc(trim(email),List) then Cleansed_List = tranwrd(List,trim(email),'');
cards;
Juke@hotmail
Frida@gmail
Killian@yahoo.com
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It creates Cleansed_List with a semi colon as delimiter in the wrong places e.g preceding certain values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to create is Cleansed list, with no semi-colon delimiter at the start and end of the resulting values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help please?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 17:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514844#M138866</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-11-20T17:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514856#M138869</link>
      <description>&lt;P&gt;Easiest would be to eliminate all the semicolons:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;list &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;catx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Juke@hotmail'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'Frida@gmail'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rest of the program should still work just fine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 17:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514856#M138869</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-20T17:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514861#M138871</link>
      <description>Show what your input data looks like and what you expect as output please.</description>
      <pubDate>Tue, 20 Nov 2018 17:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514861#M138871</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-20T17:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514885#M138876</link>
      <description>&lt;P&gt;The TRANSTRN function is what you seek.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nn;
input email :$20.;
list = catx(';','Juke@hotmail', 'Frida@gmail');
if findc(trim(email),List) then Cleansed_List = tranSTRN(List,trim(email),trimn(' '));
x = cleansed_list;
cards;
Juke@hotmail
Frida@gmail
Killian@yahoo.com
;;;;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 18:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514885#M138876</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-11-20T18:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514896#M138877</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134464"&gt;@frupaul&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n1mdh2gvd5potjn14jipysvzn4o7.htm&amp;amp;locale=en" target="_blank"&gt;FINDC&lt;/A&gt; is most likely not what you want: It searches for &lt;EM&gt;characters&lt;/EM&gt;, not substrings of length &amp;gt;1. &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p00ab6ey29t2i8n1ihel88tqtga9.htm&amp;amp;locale=en" target="_blank"&gt;FIND&lt;/A&gt; would be more appropriate, but with reversed order of arguments. &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n101a8jch5trh0n1bc5neq48hc89.htm&amp;amp;locale=en" target="_blank"&gt;TRANSTRN&lt;/A&gt; would be preferable to &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0pgemqcslm9uen1tvr5gcrusgrw.htm&amp;amp;locale=en" target="_blank"&gt;TRANWRD&lt;/A&gt; as has been mentioned already.&amp;nbsp;However, it would still leave double semicolons if an email address in the middle of a longer list was removed or the leading or trailing semicolons you have observed. &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0r8h2fa8djqf1n1cnenrvm573br.htm&amp;amp;locale=en" target="_blank"&gt;PRXCHANGE&lt;/A&gt;&amp;nbsp;should work, but it's maybe simpler to just divide the list and put it together again after omitting the email address(es) to be deleted:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nn;
length list Cleansed_List $80;
array _em[99] $20;
input email $20.;
list = catx(';', 'Juke@hotmail', 'Frida@gmail');
do _i=1 to countw(list, ';');
  _emi=scan(list, _i, ';');
  if _emi ne email then _em[_i]=_emi;
end;
Cleansed_List = catx(';', of _em[*]);
drop _:;
cards;
Juke@hotmail
Frida@gmail
Killian@yahoo.com
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Make sure to increase lengths and number of array elements if necessary.)&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 19:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514896#M138877</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-20T19:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514902#M138881</link>
      <description>&lt;P&gt;Thanks for your solution. I think you might have over complicated it using the do loops and stuff. But thanks for providing a solution&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 19:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514902#M138881</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-11-20T19:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514904#M138882</link>
      <description>&lt;P&gt;What are you actually trying to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also please look at the definitions of FINDC() and TRANWRD() as I don't think you are using either of them in an appropriate way for what I think your question might be.&amp;nbsp; FINDC() is for finding first location of any one of the characters in a list. TRANWRD() for change one string to another (as opposed to TRANSLATE() that changes individual characters), but does not really understand the concept of a word despite its name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 19:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514904#M138882</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-20T19:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Limitation of tranwrd function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514916#M138885</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;'s solution might look too complicated, but it is the only one that really works. PRXCHANGE would also work well, but compiling a new pattern for every observation&amp;nbsp;would&amp;nbsp;be&amp;nbsp;very expensive.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 20:25:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limitation-of-tranwrd-function/m-p/514916#M138885</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-11-20T20:25:59Z</dc:date>
    </item>
  </channel>
</rss>

