<?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: How to remove trailing tab characters (from SAS Code) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127226#M260288</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have and want to preserve tabs that are in the code elsewhere.&lt;/P&gt;&lt;P&gt;It they are only at the end you could just translate to blank and the put with the lines with $varying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input;&lt;/P&gt;&lt;P&gt;_infile_ = tranlate(_infile_,' ','09'x);&lt;/P&gt;&lt;P&gt;l = length(_infile_);&lt;/P&gt;&lt;P&gt;put _infile_ $varying1024. l;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Sep 2013 16:31:09 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2013-09-01T16:31:09Z</dc:date>
    <item>
      <title>How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127224#M260286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tons of SAS program code with trailing tab characters at the end of each line which I want to get rid off. Is there any function similar to TRIM that is suitable for this task?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified code (see below) taken from the following discussion that was suggested by Tom in order to deal with trailing blanks:&amp;nbsp; &lt;A _jive_internal="true" href="https://communities.sas.com/message/104870#104870"&gt;https://communities.sas.com/message/104870#104870&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I'm not sure if the modified code (see below) always leads to the desired result (removing only trailing tab characters).&lt;/P&gt;&lt;P&gt;2) Isn't there a simpler way/a function similar to TRIM to remove trailing tab characters?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "Code_w_trailingTabs.sas" lrecl=1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file "Code_wo_trailingTabs.sas" lrecl=1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b=anyalnum(_infile_,-1000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=anypunct(_infile_,-1000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc=substr(_infile_,1,max(b,c));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put abc;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 13:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127224#M260286</guid>
      <dc:creator>Georg_UPB</dc:creator>
      <dc:date>2013-09-01T13:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127225#M260287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Modifying the code you've posted something like below should work (not tested):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "Code_w_trailingTabs.sas" lrecl=1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file "Code_wo_trailingTabs.sas" lrecl=1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length abc $255;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc=PRXCHANGE('s/\t+$//oi', 1, _infile_);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put abc;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 15:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127225#M260287</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-09-01T15:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127226#M260288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have and want to preserve tabs that are in the code elsewhere.&lt;/P&gt;&lt;P&gt;It they are only at the end you could just translate to blank and the put with the lines with $varying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input;&lt;/P&gt;&lt;P&gt;_infile_ = tranlate(_infile_,' ','09'x);&lt;/P&gt;&lt;P&gt;l = length(_infile_);&lt;/P&gt;&lt;P&gt;put _infile_ $varying1024. l;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 16:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127226#M260288</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-01T16:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127227#M260289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Patrick&lt;/P&gt;&lt;P&gt;Thank you very much! I'll have to get more familiar with PRX. Your code works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@data_null_ d&lt;/P&gt;&lt;P&gt;Your code would also work nicely. However, I want to keep the tabs which I use to indent my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 16:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127227#M260289</guid>
      <dc:creator>Georg_UPB</dc:creator>
      <dc:date>2013-09-01T16:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127228#M260290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to remove the tabs?&amp;nbsp; &lt;/P&gt;&lt;P&gt;What about if there are multiple tabs at the end of the lines? Do you want to remove all of the trailing tabs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What about the tabs in the middle of the lines?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want SAS to expand the tabs in the middle of the lines to spaces?&lt;/P&gt;&lt;P&gt;One way is to have SAS convert ALL of the tabs to spaces and then remove the trailing spaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; infile 'old.sas' lrecl=1000 expandtabs;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; file 'new.sas' lrecl=1000;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; len= length(_infile_);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; put _infile_ $varying1000. len ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 16:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127228#M260290</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-01T16:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127229#M260291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi @Tom, I just want to remove all of the trailing tabs. They are the ones which were unintentionally added when code was copied/pasted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using tabs at the beginning and in the middle of the lines to indent my code, so I want to keep those.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 17:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127229#M260291</guid>
      <dc:creator>Georg_UPB</dc:creator>
      <dc:date>2013-09-01T17:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127230#M260292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whether to embed tabs in program codes is a bit of a programming Holy War topic. &lt;/P&gt;&lt;P&gt; &lt;A href="http://c2.com/cgi/wiki?TabsVersusSpaces"&gt;http://c2.com/cgi/wiki?TabsVersusSpaces&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using the SAS Enhanced Editor then you can have the best of both worlds by telling it to expand the tabs to spaces. That way you can use tabs while entering text but not get the side effects they can cause.&amp;nbsp; Just check the boxes for expanding the tabs, plus you can change the tab stop to something smaller than the screen real estate stealing 8 character default.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/images/eegen.gif" class="jive-image" src="http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/images/eegen.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 17:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127230#M260292</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-01T17:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127231#M260293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Tom&lt;/P&gt;&lt;P&gt;Thank you very much! I'm using SAS 9.3 with the enhanced editor, and it seems that I have 4 characters as tab size by default.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Sep 2013 19:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127231#M260293</guid>
      <dc:creator>Georg_UPB</dc:creator>
      <dc:date>2013-09-01T19:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove trailing tab characters (from SAS Code)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127232#M260294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Probably a little late but I was looking for the same thing and knew there is a shortcut for it in the SAS editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the answer on the support site: it's CTRL+SHIFT+W in your Editor Window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also: &lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#eeshortcuts.htm"&gt;http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#eeshortcuts.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2014 13:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-trailing-tab-characters-from-SAS-Code/m-p/127232#M260294</guid>
      <dc:creator>Anielwa</dc:creator>
      <dc:date>2014-11-27T13:29:30Z</dc:date>
    </item>
  </channel>
</rss>

