<?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 proc export to CSV - keep leading spaces in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476429#M122612</link>
    <description>&lt;P&gt;Is there an option within Proc Export that will keep leading spaces if they exist in a field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jul 2018 13:07:25 GMT</pubDate>
    <dc:creator>mthomas0</dc:creator>
    <dc:date>2018-07-09T13:07:25Z</dc:date>
    <item>
      <title>proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476429#M122612</link>
      <description>&lt;P&gt;Is there an option within Proc Export that will keep leading spaces if they exist in a field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476429#M122612</guid>
      <dc:creator>mthomas0</dc:creator>
      <dc:date>2018-07-09T13:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476445#M122618</link>
      <description>&lt;P&gt;Write your own data step, and use the $char format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
x1 = "    xxxx";
format x1 $char8.;
x2 = 5;
run;

data _null_;
set have;
file '$HOME/sascommunity/want.csv';
if _n_ = 1 then put "x1,x2";
put x1 $char8. ',' x2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The file looks like this:&lt;/P&gt;
&lt;PRE&gt;x1,x2
    xxxx,5
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS the simple $8. format will also work, as long as you use formatted output.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476445#M122618</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-09T13:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476464#M122629</link>
      <description>&lt;P&gt;thanks, this will work.&amp;nbsp; However, it would be simpler if there was an option on Proc Export to preserve leading spaces/blank as additional code has to be written in order for this solution to work.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476464#M122629</guid>
      <dc:creator>mthomas0</dc:creator>
      <dc:date>2018-07-09T14:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476469#M122631</link>
      <description>&lt;P&gt;Normally leading/trailing spaces in CSV files are removed by the consumer.&lt;/P&gt;
&lt;P&gt;Why do you want to preserve them?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476469#M122631</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-09T14:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476470#M122632</link>
      <description>&lt;P&gt;the spaces need to be preserved as information in certain parts of the column have meaning.&amp;nbsp; For example, position 50 of a column has meaning but all of the other columns could be blank.&amp;nbsp; In that case, without modifying the export, the leading spaces are being trimmed thus compromising the information.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476470#M122632</guid>
      <dc:creator>mthomas0</dc:creator>
      <dc:date>2018-07-09T14:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: proc export to CSV - keep leading spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476484#M122635</link>
      <description>&lt;P&gt;Then why not create a fixed column output file instead?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-to-CSV-keep-leading-spaces/m-p/476484#M122635</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-09T15:02:38Z</dc:date>
    </item>
  </channel>
</rss>

