<?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 Leading blank space removed while reading from datalines. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794751#M254837</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Environment : SAS ODAMID/ SAS Studio&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a dataset using datalines, wherein one of the columns has leading spaces. I want to keep the leading spaces in the created dataset which is not happening by default.&lt;/P&gt;&lt;P&gt;Would appreciate any help. Thanks in advance.&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data exp3;&lt;BR /&gt;infile datalines delimiter=","; &lt;BR /&gt;INPUT SNO :8. cat :$150.;&lt;BR /&gt;datalines;&lt;BR /&gt;1,     main category&lt;BR /&gt;2,         sub category&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;Output (Default)&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;1|main category&lt;/DIV&gt;&lt;DIV class=""&gt;2|sub category&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;BR /&gt;Desired Output&lt;/DIV&gt;&lt;DIV class=""&gt;1|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; main category&lt;/DIV&gt;&lt;DIV class=""&gt;2|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sub category&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Regards,&lt;/DIV&gt;&lt;DIV class=""&gt;Nilesh&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 07 Feb 2022 09:31:07 GMT</pubDate>
    <dc:creator>nilesh1985</dc:creator>
    <dc:date>2022-02-07T09:31:07Z</dc:date>
    <item>
      <title>Leading blank space removed while reading from datalines.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794751#M254837</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Environment : SAS ODAMID/ SAS Studio&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a dataset using datalines, wherein one of the columns has leading spaces. I want to keep the leading spaces in the created dataset which is not happening by default.&lt;/P&gt;&lt;P&gt;Would appreciate any help. Thanks in advance.&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data exp3;&lt;BR /&gt;infile datalines delimiter=","; &lt;BR /&gt;INPUT SNO :8. cat :$150.;&lt;BR /&gt;datalines;&lt;BR /&gt;1,     main category&lt;BR /&gt;2,         sub category&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;Output (Default)&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;1|main category&lt;/DIV&gt;&lt;DIV class=""&gt;2|sub category&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;BR /&gt;Desired Output&lt;/DIV&gt;&lt;DIV class=""&gt;1|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; main category&lt;/DIV&gt;&lt;DIV class=""&gt;2|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sub category&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Regards,&lt;/DIV&gt;&lt;DIV class=""&gt;Nilesh&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Feb 2022 09:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794751#M254837</guid>
      <dc:creator>nilesh1985</dc:creator>
      <dc:date>2022-02-07T09:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank space removed while reading from datalines.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794753#M254839</link>
      <description>&lt;P&gt;It's an informat thing. Use the $Charw. instead like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data exp3;
infile datalines delimiter=","; 
INPUT SNO :8. cat :$char150.;
datalines;
1,     main category
2,         sub category
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Feb 2022 09:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794753#M254839</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-07T09:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank space removed while reading from datalines.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794920#M254923</link>
      <description>On the same lines need some more clarification:-&lt;BR /&gt;data exp3;&lt;BR /&gt;infile datalines delimiter=",";&lt;BR /&gt;INPUT SNO :8. cat :$char150.;&lt;BR /&gt;datalines;&lt;BR /&gt;1, main category 1 - orthopedics&lt;BR /&gt;2, sub category&lt;BR /&gt;3, main category sub 2 - hemotology&lt;BR /&gt;4, sub category 2&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;If I manually align the sub category to come below the - of main category it gets automatically aligned with less spacing, but if i put any other character like '*' in place of space, then it works.&lt;BR /&gt;&lt;BR /&gt;Reason being i am trying to create a template for report.&lt;BR /&gt;&lt;BR /&gt;Any help would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nilesh&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2022 06:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-space-removed-while-reading-from-datalines/m-p/794920#M254923</guid>
      <dc:creator>nilesh1985</dc:creator>
      <dc:date>2022-02-08T06:31:50Z</dc:date>
    </item>
  </channel>
</rss>

