<?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: compress specific sequence of chars in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140583#M37589</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the TRANSTRN() function to replace the string INF_ with nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;desired_result = transtrn(input,'INF_',trimn(' '));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of if you know the values are always at the beginning of the string then use SUBSTR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;desired_result = input ;&lt;/P&gt;&lt;P&gt;if desired_result =: 'INF_' then desired_result = substr(desired_result,5) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 May 2014 16:39:59 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-05-01T16:39:59Z</dc:date>
    <item>
      <title>compress specific sequence of chars</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140580#M37586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was give a bunch of data sets that have been reworked to include a prefix on the variable name. I have a loop written to remove the prefix but the problem I'm encountering is the compress function is removing all characters within the prefix from the var name. I'd like it to remove the specific sequence of the letters and not all the letters. Is it possible to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The prefix in all of these example is "INF_"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Input&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Current_Result&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;P&gt;Desired_Result&lt;/P&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;INF_FINANCE&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;ACE&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;FINANCE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;INF_INFO&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;O&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;INFO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;INF_CAST&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;CAST&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;CAST&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Not all of the variables in the data set have the prefix, that is why I've attempted to do this using the compress function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 14:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140580#M37586</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2014-05-01T14:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: compress specific sequence of chars</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140581#M37587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found out how to do this using the &lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;TRANWRD&lt;/SPAN&gt; function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 14:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140581#M37587</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2014-05-01T14:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: compress specific sequence of chars</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140582#M37588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, just be careful though as if you have INF_INFO and you do a tranwrd(...,'INF','') then you would end up with _O.&amp;nbsp; If you know the prefix is INF_ first three characters, it could be beneficial to use substr, e.g. if substr(...,1,4)='INF_' then ...=substr(...,4); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 14:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140582#M37588</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-05-01T14:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: compress specific sequence of chars</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140583#M37589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the TRANSTRN() function to replace the string INF_ with nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;desired_result = transtrn(input,'INF_',trimn(' '));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of if you know the values are always at the beginning of the string then use SUBSTR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;desired_result = input ;&lt;/P&gt;&lt;P&gt;if desired_result =: 'INF_' then desired_result = substr(desired_result,5) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 16:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/compress-specific-sequence-of-chars/m-p/140583#M37589</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-05-01T16:39:59Z</dc:date>
    </item>
  </channel>
</rss>

