<?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 help exporting to fixed width text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723736#M224645</link>
    <description>&lt;P&gt;I'm trying to export some data to a fixed width text file. I can export the data okay. The problem is that the customer wants the last column (Filler) to be 42 characters. When I look at the file in a hex editor I only see 2 spaces at column 121. How can I add those extra spaces? Also how do I add column names if I want to?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data _null_;
  set final end=last;
  file "&amp;amp;&amp;amp;loc_&amp;amp;server_dest./&amp;amp;TextOut." LRECL=162 TERMSTR=crlf  recfm=v;
  put
    @1  submitter_id
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; ssn
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8008"&gt;@22&lt;/a&gt; incentive_met_date
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75109"&gt;@30&lt;/a&gt; incentive_code
    @40 incentive_amount
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290987"&gt;@50&lt;/a&gt; ssn_of_the_qualifier
    @61 birth_date_of_qualifier
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/119374"&gt;@69&lt;/a&gt; first_name_of_qualifier
    @94 last_name_of_qualifier
    @119 relationship_code_of_qualifier
	@121 Filler
  ;
run;

data have;
input @1 submitter_id $6.
   	@8 ssn $9.
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71462"&gt;@18&lt;/a&gt; incentive_met_date $8.
    @27 incentive_code $4.
/*    @40 incentive_amount $10.*/
/*    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290987"&gt;@50&lt;/a&gt; ssn_of_the_qualifier $11.*/
/*    @61 birth_date_of_qualifier $8.*/
/*    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/119374"&gt;@69&lt;/a&gt; first_name_of_qualifier $25.*/
/*    @94 last_name_of_qualifier $25.*/
    @32 relationship_code_of_qualifier $2.
;
datalines;
UHCCOE 199997187 20210119 BACK M
UHCCOE 252599991 20210118 BACK M
UHCCOE 289990538 20210125 BACK S
;
RUN;&lt;/LI-CODE&gt;
&lt;P&gt;I'&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 00:15:55 GMT</pubDate>
    <dc:creator>DanD999</dc:creator>
    <dc:date>2021-03-05T00:15:55Z</dc:date>
    <item>
      <title>help exporting to fixed width text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723736#M224645</link>
      <description>&lt;P&gt;I'm trying to export some data to a fixed width text file. I can export the data okay. The problem is that the customer wants the last column (Filler) to be 42 characters. When I look at the file in a hex editor I only see 2 spaces at column 121. How can I add those extra spaces? Also how do I add column names if I want to?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data _null_;
  set final end=last;
  file "&amp;amp;&amp;amp;loc_&amp;amp;server_dest./&amp;amp;TextOut." LRECL=162 TERMSTR=crlf  recfm=v;
  put
    @1  submitter_id
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; ssn
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8008"&gt;@22&lt;/a&gt; incentive_met_date
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75109"&gt;@30&lt;/a&gt; incentive_code
    @40 incentive_amount
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290987"&gt;@50&lt;/a&gt; ssn_of_the_qualifier
    @61 birth_date_of_qualifier
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/119374"&gt;@69&lt;/a&gt; first_name_of_qualifier
    @94 last_name_of_qualifier
    @119 relationship_code_of_qualifier
	@121 Filler
  ;
run;

data have;
input @1 submitter_id $6.
   	@8 ssn $9.
    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71462"&gt;@18&lt;/a&gt; incentive_met_date $8.
    @27 incentive_code $4.
/*    @40 incentive_amount $10.*/
/*    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290987"&gt;@50&lt;/a&gt; ssn_of_the_qualifier $11.*/
/*    @61 birth_date_of_qualifier $8.*/
/*    &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/119374"&gt;@69&lt;/a&gt; first_name_of_qualifier $25.*/
/*    @94 last_name_of_qualifier $25.*/
    @32 relationship_code_of_qualifier $2.
;
datalines;
UHCCOE 199997187 20210119 BACK M
UHCCOE 252599991 20210118 BACK M
UHCCOE 289990538 20210125 BACK S
;
RUN;&lt;/LI-CODE&gt;
&lt;P&gt;I'&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 00:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723736#M224645</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2021-03-05T00:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: help exporting to fixed width text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723745#M224649</link>
      <description>&lt;P&gt;You have recfm=v which apparently eliminates trailing blanks in filler.&amp;nbsp; But changing to recfm=f will apparently drop the CRLF at the end of each line (just did a test on my windows machine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change the end of your PUT statement from&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	@121 Filler&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	@121 Filler $42.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Doing that caused my sas log to report maximum length and minimum length of output records both at 162, even with a total blank FILLER.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 02:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723745#M224649</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-05T02:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: help exporting to fixed width text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723751#M224652</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You have recfm=v which apparently eliminates trailing blanks in filler.&amp;nbsp; But changing to recfm=f will apparently drop the CRLF at the end of each line (just did a test on my windows machine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change the end of your PUT statement from&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	@121 Filler&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	@121 Filler $42.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Doing that caused my sas log to report maximum length and minimum length of output records both at 162, even with a total blank FILLER.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It worked. Do you know how to add column headings? Thanks so much.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 02:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-exporting-to-fixed-width-text-file/m-p/723751#M224652</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2021-03-05T02:45:57Z</dc:date>
    </item>
  </channel>
</rss>

