<?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 lines with spaces at the end in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469192#M119966</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i export a data if have spaces at the and. I need this blank spaces at the end. I have a table with one cloumn (length $141.)&lt;/P&gt;&lt;P&gt;If i export the table to a txt cut the blank spaces at the end of the line and take a tabulator. How can i avoid this?&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set table ;&lt;BR /&gt;call execute('proc export&lt;BR /&gt;data=x_table&lt;BR /&gt;outfile="C:\temp\sample.xt"&lt;BR /&gt;dbms=tab replace ;&lt;BR /&gt;putnames=no;&lt;BR /&gt;run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now i have in the txt :&lt;/P&gt;&lt;P&gt;1 2 3 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XYZ(after that TABULATOR)&lt;/P&gt;&lt;P&gt;and i need this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 2 3 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XYZ(after the i need spaces until that i reach the $141. length)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank for all help!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 12:26:47 GMT</pubDate>
    <dc:creator>ger15xxhcker</dc:creator>
    <dc:date>2018-06-11T12:26:47Z</dc:date>
    <item>
      <title>proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469192#M119966</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i export a data if have spaces at the and. I need this blank spaces at the end. I have a table with one cloumn (length $141.)&lt;/P&gt;&lt;P&gt;If i export the table to a txt cut the blank spaces at the end of the line and take a tabulator. How can i avoid this?&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set table ;&lt;BR /&gt;call execute('proc export&lt;BR /&gt;data=x_table&lt;BR /&gt;outfile="C:\temp\sample.xt"&lt;BR /&gt;dbms=tab replace ;&lt;BR /&gt;putnames=no;&lt;BR /&gt;run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now i have in the txt :&lt;/P&gt;&lt;P&gt;1 2 3 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XYZ(after that TABULATOR)&lt;/P&gt;&lt;P&gt;and i need this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 2 3 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xyz&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XYZ(after the i need spaces until that i reach the $141. length)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank for all help!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 12:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469192#M119966</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2018-06-11T12:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469196#M119968</link>
      <description>&lt;P&gt;I am not sure .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x "C:\temp\sample.xt" lrecl=200;

proc export
data=x_table
outfile=x
dbms=tab replace ;
putnames=no;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 12:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469196#M119968</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-11T12:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469220#M119981</link>
      <description>&lt;P&gt;Sorry, your post makes no sense.&amp;nbsp; Why are you call executing something with no changes to the code:&lt;/P&gt;
&lt;PRE&gt;proc export data=x_table outfile="C:\temp\sample.xt" dbms=tab replace;
  putnames=no;
run;&lt;/PRE&gt;
&lt;P&gt;Is exactly the same?&lt;/P&gt;
&lt;P&gt;Also, what is an xt file?&amp;nbsp; Maybe a typo.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please clarify what you mean by "&lt;SPAN&gt;after the i need spaces until that i reach the $141. length)" as adding in spaces after the end of the data makes no sense, there is nothing after XYZ to indicate the string stops?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469220#M119981</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-11T13:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469247#M119995</link>
      <description>&lt;P&gt;Sorry for my wording. I attached 2 file. The "bad" one is the actual state. The "good" one is what i want to make.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I have one table with 1 columns this column length is $141. (x_table)&lt;/P&gt;&lt;P&gt;2. I have to export to a txt file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. If i use this code I&amp;nbsp;get the good.txt file:&lt;/P&gt;&lt;P&gt;proc export data=x_table outfile="C:\temp\sample.txt" dbms=tab replace; putnames=no;run;&amp;nbsp; (line(s) ending with linebrake instead of spaces)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if i have in a table a $100. length line in the output .txt file have to take +41 spaces to fill the line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;soory for my bad english.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Gergő&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469247#M119995</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2018-06-11T14:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469250#M119996</link>
      <description>&lt;P&gt;Well, all I can think of is to put out the data yourself.:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set x_table;
  file "...abc.txt";
  put vara $141. varb $50...;
run;&lt;/PRE&gt;
&lt;P&gt;Whether that puts spaces at the end, you would have to check, don't see why it should matter however,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;abc&amp;nbsp; &amp;nbsp; &amp;nbsp;$&lt;/P&gt;
&lt;P&gt;abc$&lt;/P&gt;
&lt;P&gt;With $ being the end of line, are exactly the same?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469250#M119996</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-11T14:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469253#M119999</link>
      <description>&lt;P&gt;thanks but it doesn't work &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469253#M119999</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2018-06-11T14:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469262#M120004</link>
      <description>&lt;P&gt;Yes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;abc&amp;nbsp; &amp;nbsp; &amp;nbsp;$&lt;/P&gt;&lt;P&gt;abc$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;is the same. Just i have to put spaces after "abc" until i reach the 141. place.&amp;nbsp; How can i code this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469262#M120004</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2018-06-11T14:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469264#M120005</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192091"&gt;@ger15xxhcker&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry for my wording. I attached 2 file. The "bad" one is the actual state. The "good" one is what i want to make.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. I have one table with 1 columns this column length is $141. (x_table)&lt;/P&gt;
&lt;P&gt;2. I have to export to a txt file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. If i use this code I&amp;nbsp;get the good.txt file:&lt;/P&gt;
&lt;P&gt;proc export data=x_table outfile="C:\temp\sample.txt" dbms=tab replace; putnames=no;run;&amp;nbsp; (line(s) ending with linebrake instead of spaces)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so if i have in a table a $100. length line in the output .txt file have to take +41 spaces to fill the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;soory for my bad english.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;Gergő&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Line "length" is kind of a hazy concept when using dbms=TAB as tab characters are variable in appearance depending upon the viewing program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure I really understand the problem but perhaps using an appropriate LRECL and RECFM=F such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename outfl ="C:\temp\sample.txt" lrecl=141 recfm=F;&lt;/P&gt;
&lt;P&gt;and use in your output:&lt;/P&gt;
&lt;P&gt;proc export data=x_table outfileoutfl dbms=tab replace; putnames=no;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step LRECL plus the PAD option should also write blanks to the desired length.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469264#M120005</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-11T14:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc export lines with spaces at the end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469269#M120008</link>
      <description>&lt;P&gt;Thanks for your help, but now all of the datas in my table will be one line on the out file txt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 15:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-lines-with-spaces-at-the-end/m-p/469269#M120008</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2018-06-11T15:06:25Z</dc:date>
    </item>
  </channel>
</rss>

