<?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: %trim function in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/trim-function/m-p/67196#M6740</link>
    <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You're always using "Base SAS" no matter how you execute the code.&lt;BR /&gt;
&lt;BR /&gt;
If this is a macro variable created in a autoexec then there might be a difference between a SAS DI session (like SAS EG created by the Object Spawner) and a PC SAS session - and you might not have fully access to this macro var from within the session (as soon as you batch the job you will have full access).&lt;BR /&gt;
&lt;BR /&gt;
I can be wrong here but I think that strings assigned to macro vars are always stripped of leading and trailing blanks.&lt;BR /&gt;
&lt;BR /&gt;
What could be is that you're string is quoted - and an %unquote() could solve the problem.&lt;BR /&gt;
&lt;BR /&gt;
Have a look at the following example:  &lt;BR /&gt;
%let TESTVAR1=   xxx y   ;&lt;BR /&gt;
%put TESTVAR1 unquoted:  Length is: %length(&amp;amp;TESTVAR1), Value is: &amp;amp;TESTVAR1; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR2=%quote(           xxx y   );&lt;BR /&gt;
%put TESTVAR2 quoted:  Length is: %length(&amp;amp;TESTVAR2), Value is: &amp;amp;TESTVAR2; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR3=%quote(           xxx y   );&lt;BR /&gt;
%let TESTVAR3=%trim(&amp;amp;TESTVAR3);&lt;BR /&gt;
%put TESTVAR3 quoted/trim:  Length is: %length(&amp;amp;TESTVAR3), Value is: &amp;amp;TESTVAR3; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR4=%quote(   xxx y   );&lt;BR /&gt;
%let TESTVAR4=%unquote(&amp;amp;TESTVAR4);&lt;BR /&gt;
%put TESTVAR4 quoted/unquoted:  Length is: %length(&amp;amp;TESTVAR4), Value is: &amp;amp;TESTVAR4;</description>
    <pubDate>Fri, 26 Dec 2008 12:10:04 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2008-12-26T12:10:04Z</dc:date>
    <item>
      <title>%trim function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/trim-function/m-p/67195#M6739</link>
      <description>Hi&lt;BR /&gt;
      i have to remove the leading and trailing space in the value of macro variable.&lt;BR /&gt;
    i am working in SAS DI studio.&lt;BR /&gt;
i have tried %trim()....it is not working ...whereas it is working fine in Base SAS.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
please i need help...</description>
      <pubDate>Fri, 26 Dec 2008 11:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/trim-function/m-p/67195#M6739</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-12-26T11:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: %trim function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/trim-function/m-p/67196#M6740</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You're always using "Base SAS" no matter how you execute the code.&lt;BR /&gt;
&lt;BR /&gt;
If this is a macro variable created in a autoexec then there might be a difference between a SAS DI session (like SAS EG created by the Object Spawner) and a PC SAS session - and you might not have fully access to this macro var from within the session (as soon as you batch the job you will have full access).&lt;BR /&gt;
&lt;BR /&gt;
I can be wrong here but I think that strings assigned to macro vars are always stripped of leading and trailing blanks.&lt;BR /&gt;
&lt;BR /&gt;
What could be is that you're string is quoted - and an %unquote() could solve the problem.&lt;BR /&gt;
&lt;BR /&gt;
Have a look at the following example:  &lt;BR /&gt;
%let TESTVAR1=   xxx y   ;&lt;BR /&gt;
%put TESTVAR1 unquoted:  Length is: %length(&amp;amp;TESTVAR1), Value is: &amp;amp;TESTVAR1; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR2=%quote(           xxx y   );&lt;BR /&gt;
%put TESTVAR2 quoted:  Length is: %length(&amp;amp;TESTVAR2), Value is: &amp;amp;TESTVAR2; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR3=%quote(           xxx y   );&lt;BR /&gt;
%let TESTVAR3=%trim(&amp;amp;TESTVAR3);&lt;BR /&gt;
%put TESTVAR3 quoted/trim:  Length is: %length(&amp;amp;TESTVAR3), Value is: &amp;amp;TESTVAR3; &lt;BR /&gt;
&lt;BR /&gt;
%let TESTVAR4=%quote(   xxx y   );&lt;BR /&gt;
%let TESTVAR4=%unquote(&amp;amp;TESTVAR4);&lt;BR /&gt;
%put TESTVAR4 quoted/unquoted:  Length is: %length(&amp;amp;TESTVAR4), Value is: &amp;amp;TESTVAR4;</description>
      <pubDate>Fri, 26 Dec 2008 12:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/trim-function/m-p/67196#M6740</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2008-12-26T12:10:04Z</dc:date>
    </item>
  </channel>
</rss>

