<?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 removing leading blanks from a macro value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/removing-leading-blanks-from-a-macro-value/m-p/874667#M345598</link>
    <description>&lt;P&gt;The following&amp;nbsp; code produces leading blanks before the value for "&amp;amp;median" below.&amp;nbsp; &amp;nbsp;How can I remove the blanks?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Title3 "The median daily total between &amp;amp;min_date and &amp;amp;max_date was &amp;amp;median";&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2023 14:25:58 GMT</pubDate>
    <dc:creator>Batman</dc:creator>
    <dc:date>2023-05-09T14:25:58Z</dc:date>
    <item>
      <title>removing leading blanks from a macro value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-leading-blanks-from-a-macro-value/m-p/874667#M345598</link>
      <description>&lt;P&gt;The following&amp;nbsp; code produces leading blanks before the value for "&amp;amp;median" below.&amp;nbsp; &amp;nbsp;How can I remove the blanks?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Title3 "The median daily total between &amp;amp;min_date and &amp;amp;max_date was &amp;amp;median";&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 14:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-leading-blanks-from-a-macro-value/m-p/874667#M345598</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2023-05-09T14:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: removing leading blanks from a macro value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/removing-leading-blanks-from-a-macro-value/m-p/874670#M345599</link>
      <description>&lt;P&gt;If the spaces are not macro quoted you can just recreate the macro variable from its value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let median=&amp;amp;median;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If they are macro quoted then you might need the %unquote() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let median=%unquote(&amp;amp;median);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the real solution is to not put the spaces into the macro variable to begin with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are making it with a data step then make sure the use the new (only 20 years old) CALL SYMPUTX() method instead of the ancient CALL SYMPUT() method.&amp;nbsp; That will will strip leading and trailing spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have;
  call symputx('median',median);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are making it with PROC SQL and the INTO clause then make sure to add the TRIMMED keyword.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select min_date,max_date,median
  into :min_date trimmed
     , :max_date trimmed
     , :median trimmed 
  from have
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 14:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/removing-leading-blanks-from-a-macro-value/m-p/874670#M345599</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-09T14:34:26Z</dc:date>
    </item>
  </channel>
</rss>

