<?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: SQL Macro value has &amp;quot;space&amp;quot; in front in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449926#M113292</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint; 
 select RR into: RR   separated by ' '
 from w;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Mar 2018 13:39:47 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-03-30T13:39:47Z</dc:date>
    <item>
      <title>SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449816#M113255</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I use SQL to save macro value.&lt;/P&gt;
&lt;P&gt;Some how when I use it in code, the value has space in front which return error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;  select RR into: RR from w; quit;&lt;BR /&gt;%put "macro value:" &amp;amp;rr&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;keep type_RR&amp;amp;RR._sl &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when &amp;amp;RR=3, the above code return these value. there is space in front.&lt;/P&gt;
&lt;P&gt;In SAS log, that space appear to be a "tab" (big gap).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;"macro value:" 3&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Type_RR 3_sl&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Can you please help me with that?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;HHCFX&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 01:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449816#M113255</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-03-30T01:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449825#M113261</link>
      <description>&lt;P&gt;TRIMMED option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 02:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449825#M113261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-30T02:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449827#M113262</link>
      <description>&lt;P&gt;My trick is:&lt;/P&gt;
&lt;P&gt;after the SQL to get macro variable RR, I put the code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let RR=&amp;amp;RR;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so the problem is solved.&lt;/P&gt;
&lt;P&gt;But so curious why that space come in the first place.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 02:08:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449827#M113262</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-03-30T02:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449829#M113263</link>
      <description>&lt;P&gt;That's an extra step&amp;nbsp;and a really old way to deal with it.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;My trick is:&lt;/P&gt;
&lt;P&gt;after the SQL to get macro variable RR, I put the code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let RR=&amp;amp;RR;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so the problem is solved.&lt;/P&gt;
&lt;P&gt;But so curious why that space come in the first place.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's because&amp;nbsp;macro variables are characters and you didn't specify a length so it assumed one and added spaces for it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 02:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449829#M113263</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-30T02:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449830#M113264</link>
      <description>numeric to character conversion.  right justified in a field 12 bytes long</description>
      <pubDate>Fri, 30 Mar 2018 02:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449830#M113264</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-03-30T02:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449832#M113265</link>
      <description>&lt;P&gt;So we can do Trim inside the SQL?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 02:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449832#M113265</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2018-03-30T02:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449837#M113267</link>
      <description>&lt;P&gt;Yes, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select age into :age trimmed
   from sashelp.class
   where name = 'Mary'
   ;
quit;

%put age = &amp;amp;age;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can use SQL functions to get the same result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select strip(put(age, 8.)) into :age 
   from sashelp.class
   where name = 'Mary'
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 03:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449837#M113267</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-03-30T03:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Macro value has "space" in front</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449926#M113292</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint; 
 select RR into: RR   separated by ' '
 from w;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Mar 2018 13:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Macro-value-has-quot-space-quot-in-front/m-p/449926#M113292</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-30T13:39:47Z</dc:date>
    </item>
  </channel>
</rss>

