<?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 add leading space in values of a variable? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822523#M25870</link>
    <description>&lt;P&gt;This is certainly a rather unusual request and I assume you want to do this for some reporting/indention.&lt;/P&gt;
&lt;P&gt;You can easily add leading blanks just by concatenating such blanks to the variable BUT depending on the procedure and especially the output destination used these leading blanks might still not print as you'd like it.&lt;/P&gt;
&lt;P&gt;Consider the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length var2 var3 $10;
  format var3 $char10.;
  var='abcd';
  var2='     '||var;
  var3='     '||var;
run;
ods listing;
proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Listing destination:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1657536713532.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73124i19830D07F0883263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1657536713532.png" alt="Patrick_1-1657536713532.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;HTML destination (the SAS EG default):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_2-1657536843688.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73125i3E410A40861E303F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_2-1657536843688.png" alt="Patrick_2-1657536843688.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if this is about reporting/printing then eventually it's more about using styles instead of adding blanks to the internal value of SAS variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let us know a bit more in detail what you have and what you need and we can go from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jul 2022 10:56:35 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2022-07-11T10:56:35Z</dc:date>
    <item>
      <title>How to add leading space in values of a variable?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822517#M25868</link>
      <description>I want to know how to add leading spaces in SAS for values of a character variable. Kindly note that I do not want to remove spaces but want to add 5 white spaces in the leading section of values of a character variable. Thanks in advance.</description>
      <pubDate>Mon, 11 Jul 2022 10:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822517#M25868</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2022-07-11T10:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to add leading space in values of a variable?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822518#M25869</link>
      <description>&lt;P&gt;Is the variable long enough to store five additional chars? Something like this should do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var = cat(repeat(' ', 4), var);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note, that html and log may hide those leading spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 10:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822518#M25869</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-07-11T10:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add leading space in values of a variable?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822523#M25870</link>
      <description>&lt;P&gt;This is certainly a rather unusual request and I assume you want to do this for some reporting/indention.&lt;/P&gt;
&lt;P&gt;You can easily add leading blanks just by concatenating such blanks to the variable BUT depending on the procedure and especially the output destination used these leading blanks might still not print as you'd like it.&lt;/P&gt;
&lt;P&gt;Consider the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length var2 var3 $10;
  format var3 $char10.;
  var='abcd';
  var2='     '||var;
  var3='     '||var;
run;
ods listing;
proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Listing destination:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1657536713532.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73124i19830D07F0883263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1657536713532.png" alt="Patrick_1-1657536713532.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;HTML destination (the SAS EG default):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_2-1657536843688.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73125i3E410A40861E303F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_2-1657536843688.png" alt="Patrick_2-1657536843688.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if this is about reporting/printing then eventually it's more about using styles instead of adding blanks to the internal value of SAS variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let us know a bit more in detail what you have and what you need and we can go from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 10:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822523#M25870</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-07-11T10:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to add leading space in values of a variable?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822533#M25871</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;for the quick response. I was also thinking on the same lines but it was not working at that time. However, after sometime the solution given by you worked, however, I had not seen your response at that time. It just worked (maybe there was some other issue) and now I am seeing your response. Thanks a lot once again for the quick response. It is surely helpful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Dr. Abhijeet Safai&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 12:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-leading-space-in-values-of-a-variable/m-p/822533#M25871</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2022-07-11T12:00:29Z</dc:date>
    </item>
  </channel>
</rss>

