<?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: .txt output with fixed columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485196#M126029</link>
    <description>&lt;P&gt;You can use the column pointer&amp;nbsp;@ like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
  set sashelp.class ;
  file '/home/jm25324/test.txt';
  If _n_=1 then do;
     put @1 'Name' @ 20 'Sex' @25 'Age' @30 'Height' @40 'Weight';
  end;
  put @1 name @ 20 sex @25 age @30 height @40 weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 08 Aug 2018 15:43:30 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-08-08T15:43:30Z</dc:date>
    <item>
      <title>.txt output with fixed columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485190#M126027</link>
      <description>&lt;P&gt;I am trying to create .txt output with column names and output in columns.&amp;nbsp; I've tried Proc Export, Data _null_ with Puts, ODS (multiple versions).&amp;nbsp; The results I keep getting returned is warped text.&amp;nbsp; I need columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are&amp;nbsp;3 of my many attempts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;export&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=sashelp.class&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; outfile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/home/jm25324/class.txt"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; dbms&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=tab &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;replace&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sashelp.class ; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; file&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'/home/jm25324/test.txt'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dlm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;","&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; If&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _n_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'Name, Sex, Age, Height, Weight'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp; put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; name sex age height weight;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;csvall&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;file&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'/home/jm25324/test5.txt'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;report&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=sashelp.class &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nocenter&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;headline&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;headskip&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;spacing&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;nowd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;column&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; name sex age height weight;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; name / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;display&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;order&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"Name"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;width&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sex / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;display&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"Sex"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;width&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;flow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; age / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;display&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"Age"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;width&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;flow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; height / &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Height"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;width&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;flow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; weight / &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Weight"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;width&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;40&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;flow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;csvall&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 15:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485190#M126027</guid>
      <dc:creator>jeninemilum</dc:creator>
      <dc:date>2018-08-08T15:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: .txt output with fixed columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485196#M126029</link>
      <description>&lt;P&gt;You can use the column pointer&amp;nbsp;@ like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
  set sashelp.class ;
  file '/home/jm25324/test.txt';
  If _n_=1 then do;
     put @1 'Name' @ 20 'Sex' @25 'Age' @30 'Height' @40 'Weight';
  end;
  put @1 name @ 20 sex @25 age @30 height @40 weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 15:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485196#M126029</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-08T15:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: .txt output with fixed columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485199#M126030</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'm not sure of the purpose of fixed width columns with a comma separator. Do you mean something like this? I'd do it using full control of my PUT statements:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fixed_width_and_comma.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22335iAEF31FDFC7DF5CC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="fixed_width_and_comma.png" alt="fixed_width_and_comma.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I don't really understand what you mean when you say "with column names and output in columns" but this is how I interpreted it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 15:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485199#M126030</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-08-08T15:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: .txt output with fixed columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485210#M126033</link>
      <description>&lt;P&gt;Fixed column normally means something like variable 1 will occupy columns 1 through 10, variable 2 columns 11 to 17, variable 3 columns 18 to 25 for example and no specific character between values though spaces occur if the length of the variable value is smaller than the space used.&lt;/P&gt;
&lt;P&gt;Is that what you want? You are showing comma separated values in your header row in the data _null_ data step and requesting comma separated columns in for the proc report output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you are looking for something like:&lt;/P&gt;
&lt;PRE&gt;ods listing file='/home/jm25324/test5.txt';
proc print noobs data=sashelp.class;
run;
ods listing close;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 16:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485210#M126033</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-08T16:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: .txt output with fixed columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485495#M126145</link>
      <description>Here is the solution using the options TERMSTR=crlf:&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set sashelp.class ;&lt;BR /&gt;file '/home/jm25324/test6.txt' TERMSTR=crlf;&lt;BR /&gt;If _n_=1 then do;&lt;BR /&gt;put @1 'Name' @ 20 'Sex' &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; 'Age' &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75109"&gt;@30&lt;/a&gt; 'Height' @40 'Weight';&lt;BR /&gt;end;&lt;BR /&gt;put @1 name @ 20 sex &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; age &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75109"&gt;@30&lt;/a&gt; height @40 weight;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2018 14:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/txt-output-with-fixed-columns/m-p/485495#M126145</guid>
      <dc:creator>jeninemilum</dc:creator>
      <dc:date>2018-08-09T14:25:22Z</dc:date>
    </item>
  </channel>
</rss>

