<?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 with initial space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194422#M36567</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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think SQL will trim off the leading blanks by default, I don't know of a way to switch it off.&amp;nbsp; However you can easily fool it:&lt;/P&gt;&lt;P&gt;data tmp;&lt;/P&gt;&lt;P&gt;cat="First level&amp;nbsp; ";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat="_Second level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat="__Third level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct cat into :var_levels separated by "#"&lt;/P&gt;&lt;P&gt;&amp;nbsp; from tmp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put %sysfunc(tranwrd(&amp;amp;var_levels,_, ));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depends on what you want it for really.&amp;nbsp; If I am doing rtf output then I would put the rtf code in the variable.&amp;nbsp; Alternatively if you are creating a string from the 3 levels, then a retain, if last then output, should work.&amp;nbsp; Or you could tranpose them etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Aug 2015 14:04:45 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-08-07T14:04:45Z</dc:date>
    <item>
      <title>SQL with initial space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194419#M36564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if there is any way to conserve the left blancs with SQL. See the following example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tmp;&lt;/P&gt;&lt;P&gt;cat="First level&amp;nbsp; ";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat=" Second level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat="&amp;nbsp; Third level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct cat into :var_levels separated by "#"&lt;/P&gt;&lt;P&gt;&amp;nbsp; from tmp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;var_levels;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I obtain this output&lt;/P&gt;&lt;P&gt;Third level#Second level#First level&lt;/P&gt;&lt;P&gt;and I like to have&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Third level# Second level#&amp;nbsp; First level.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 13:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194419#M36564</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2015-08-07T13:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: SQL with initial space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194420#M36565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the doc &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;notrim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;separated by "#" notrim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hth,&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 14:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194420#M36565</guid>
      <dc:creator>EricHoogenboom</dc:creator>
      <dc:date>2015-08-07T14:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: SQL with initial space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194421#M36566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, like in almost everywhere the text is not trim I have not think about a possible option to do it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 14:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194421#M36566</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2015-08-07T14:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL with initial space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194422#M36567</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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think SQL will trim off the leading blanks by default, I don't know of a way to switch it off.&amp;nbsp; However you can easily fool it:&lt;/P&gt;&lt;P&gt;data tmp;&lt;/P&gt;&lt;P&gt;cat="First level&amp;nbsp; ";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat="_Second level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;cat="__Third level";&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct cat into :var_levels separated by "#"&lt;/P&gt;&lt;P&gt;&amp;nbsp; from tmp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%put %sysfunc(tranwrd(&amp;amp;var_levels,_, ));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depends on what you want it for really.&amp;nbsp; If I am doing rtf output then I would put the rtf code in the variable.&amp;nbsp; Alternatively if you are creating a string from the 3 levels, then a retain, if last then output, should work.&amp;nbsp; Or you could tranpose them etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 14:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-with-initial-space/m-p/194422#M36567</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-07T14:04:45Z</dc:date>
    </item>
  </channel>
</rss>

