<?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 unwanted characters (zzzzzz,zzzzzzzzz,zz) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75678#M21961</link>
    <description>Or you could use the translate function:&lt;BR /&gt;
&lt;BR /&gt;
TRANSLATE(source,to-1,from-1&amp;lt;,...to-n,from-n&amp;gt;) &lt;BR /&gt;
&lt;BR /&gt;
so ....&lt;BR /&gt;
&lt;BR /&gt;
name=translate(name,' ','z');&lt;BR /&gt;
&lt;BR /&gt;
I assume you might expect some valid Zs so you might want to code round the function so that it only takes place if there are not non-z characters on either side of the z or something.&lt;BR /&gt;
&lt;BR /&gt;
Alos, note the confusing way the translate has the TO before the FROM, personally I would have made it the other way round but there you go.</description>
    <pubDate>Fri, 27 Feb 2009 11:17:41 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-02-27T11:17:41Z</dc:date>
    <item>
      <title>Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75676#M21959</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
I have some observations which are like this&lt;BR /&gt;
&lt;BR /&gt;
data name;&lt;BR /&gt;
input id$ name$ add$;&lt;BR /&gt;
cards;&lt;BR /&gt;
mailtohim       nani     mainroad&lt;BR /&gt;
zzzzz            zzz      street&lt;BR /&gt;
raju               zzzz     zzzzzzzzzzzzz&lt;BR /&gt;
zzzzzzzz      zz         indi&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I have 200 variables in some variables the observations are filled with zzzz and i dont the number of zzzzzz present how can i eliminte and keep space at that place</description>
      <pubDate>Fri, 27 Feb 2009 05:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75676#M21959</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2009-02-27T05:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75677#M21960</link>
      <description>If I understand your challenge correctly, you can use the SUBSTR function on the left side of the SAS assignment statement in a DATA step.  And if you are unsure at what position the string starts, you can use the INDEX function to find the starting offset before using the SUBSTR function to change the value from "zzzzzz" to "      " (six blank characters).  And, you can use an ARRAY statement to setup a DO loop through your list of 200 SAS variables, so that you do not need to repeat the same code for each variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 27 Feb 2009 07:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75677#M21960</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-02-27T07:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75678#M21961</link>
      <description>Or you could use the translate function:&lt;BR /&gt;
&lt;BR /&gt;
TRANSLATE(source,to-1,from-1&amp;lt;,...to-n,from-n&amp;gt;) &lt;BR /&gt;
&lt;BR /&gt;
so ....&lt;BR /&gt;
&lt;BR /&gt;
name=translate(name,' ','z');&lt;BR /&gt;
&lt;BR /&gt;
I assume you might expect some valid Zs so you might want to code round the function so that it only takes place if there are not non-z characters on either side of the z or something.&lt;BR /&gt;
&lt;BR /&gt;
Alos, note the confusing way the translate has the TO before the FROM, personally I would have made it the other way round but there you go.</description>
      <pubDate>Fri, 27 Feb 2009 11:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75678#M21961</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-27T11:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75679#M21962</link>
      <description>The OP stated clearly that the string to be manipulated represented a "word" -- so possibly TRANWRD may apply.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sat, 28 Feb 2009 14:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75679#M21962</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-02-28T14:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75680#M21963</link>
      <description>sounds like an ideal case for regular expression handling. &lt;BR /&gt;
Unfortunately, I can't claim the expertise needed to quickly reply with the code you want. So, Michel_SAS, I recommend you read up on prxchange(). See &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002601591.htm#a003190494" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a002601591.htm#a003190494&lt;/A&gt; for an example that might be close to what you seek.&lt;BR /&gt;
 &lt;BR /&gt;
 PeterC</description>
      <pubDate>Sun, 01 Mar 2009 16:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75680#M21963</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-03-01T16:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Removing unwanted characters (zzzzzz,zzzzzzzzz,zz)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75681#M21964</link>
      <description>I think the code below should do the job.&lt;BR /&gt;
Use the translate version if you want to keep as many blanks as there were 'z' - else use the compress version.&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
data name;&lt;BR /&gt;
  input id$ name$ add$;&lt;BR /&gt;
  array vars {*} name add;&lt;BR /&gt;
  do i=1 to dim(vars);&lt;BR /&gt;
    if compress(lowcase(vars{i}),'z')='' then&lt;BR /&gt;
/*      vars{i}=translate(lowcase(vars{i}),' ','z');*/&lt;BR /&gt;
      vars{i}=compress(lowcase(vars{i}),'z');&lt;BR /&gt;
    put vars{i}= @;&lt;BR /&gt;
  end;&lt;BR /&gt;
  put;&lt;BR /&gt;
cards;&lt;BR /&gt;
mailtohim nani mainroad&lt;BR /&gt;
zzzzz zzz street&lt;BR /&gt;
raju zzAzz zzzzzzzzzzzzz&lt;BR /&gt;
zzzzzzzz zz indi&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 02 Mar 2009 08:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-unwanted-characters-zzzzzz-zzzzzzzzz-zz/m-p/75681#M21964</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-03-02T08:38:52Z</dc:date>
    </item>
  </channel>
</rss>

