<?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: how to create a trailer with in the column positions in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/315151#M21265</link>
    <description>&lt;P&gt;Ah, ok, use the&amp;nbsp;@ to position the pointer at the place of the last variable:&lt;/P&gt;
&lt;PRE&gt;data have;
  name="Thomas"; city="New Jersy"; country="USA"; id="1000"; output;
  name="David"; city="New Jersy"; country="USA"; id="1005"; output;
run;

data _null_;
  set have nobs=num_obs end=last;
  file "s:\temp\rob\text.txt";
  if _n_=1 then put @1 "AL16" @31 "0000";
  put Name $ 1 - 17
      City $ 18 - 25
      Country $ 26 - 30
      Id $ 31 - 46;
  tmp=strip(put(num_obs,z3.));
  if last then put @1 "DL99" @31 tmp;
run;
  &lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Nov 2016 11:07:09 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-11-29T11:07:09Z</dc:date>
    <item>
      <title>how to create a trailer with in the column positions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314852#M21241</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am working on a dataset &lt;/SPAN&gt;&lt;SPAN&gt;to create an out put txt file with header and trailer records .I had created the Header and trailer ( count of total records). I want&amp;nbsp;the&amp;nbsp;&lt;SPAN&gt;header and trailer starts with first column&amp;nbsp;and ends with the last column of the record .&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Script:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;%let filePath = /user/home/test;&lt;BR /&gt;libname test '/user/home/test/';&lt;BR /&gt;%include 'user/home/test/TDpwd.txt';&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CONNECT TO TERADATA (user=&amp;amp;user password=&amp;amp;password server=oneview mode=teradata);&lt;BR /&gt;create table test.test_data as&lt;BR /&gt;select * from connection to teradata(&lt;BR /&gt;SELECT * from 5pt.test24&lt;BR /&gt;);&lt;BR /&gt;disconnect from teradata;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;Data test.test_result;&lt;BR /&gt;set test.test_data;&lt;BR /&gt;file "&amp;amp;filePath/test.data_2016";&lt;BR /&gt;put&lt;BR /&gt;Name $ 1 - 17&lt;BR /&gt;City $ 18 - 25&lt;BR /&gt;Country $ 26 - 30&lt;BR /&gt;Id $ 31 - 46&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;set &lt;SPAN&gt;test.test_data&lt;/SPAN&gt; END=EOF;&lt;BR /&gt;file "&amp;amp;filePath/&lt;SPAN&gt;data_2016&lt;/SPAN&gt;";&lt;/P&gt;&lt;P&gt;*Header record;&lt;BR /&gt;If _n_=1 then&lt;BR /&gt;do;&lt;BR /&gt;put 'AL,,,0000';&lt;BR /&gt;end;&lt;BR /&gt;put name city country id ;&lt;BR /&gt;/*Trailer record*/&lt;BR /&gt;if eof then&lt;BR /&gt;do;&lt;BR /&gt;put _N_ : z4.;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;ex: Output :&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AL16 &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; &amp;nbsp; &amp;nbsp;0000&lt;BR /&gt;Thomas New Jersy USA 1000&lt;BR /&gt;David &amp;nbsp; &amp;nbsp; New Jersy USA 1000&lt;BR /&gt;Rahul &amp;nbsp; &amp;nbsp; Virginia &amp;nbsp; &amp;nbsp; &amp;nbsp;USA 2002&lt;BR /&gt;DL99 &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; &amp;nbsp; 0003&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Madhu&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 15:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314852#M21241</guid>
      <dc:creator>tvbMadhu</dc:creator>
      <dc:date>2016-11-28T15:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a trailer with in the column positions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314856#M21242</link>
      <description>&lt;P&gt;You be able to do this simply with nobs= and end=, quite simply (I don't know what the AL or DL is though):&lt;/P&gt;
&lt;PRE&gt;data have;
  name="Thomas"; city="New Jersy"; country="USA"; id=1000; output;
  name="David"; city="New Jersy"; country="USA"; id=1005; output;
run;

data _null_;
  set have nobs=num_obs end=last;
  file "s:\temp\rob\text.txt";
  if _n_=1 then put "AL16             0000";
  put Name $ 1 - 17
      City $ 18 - 25
      Country $ 26 - 30
      Id $ 31 - 46;
  tmp="DL99             "||strip(put(num_obs,z3.));
  if last then put tmp;
run;&lt;/PRE&gt;
&lt;P&gt;Also, I would avoid file formats you come up with yourself, it just makes it headache for anyone using that file later on who may or may not know about your specific file setup. &amp;nbsp;Also, I don't see any extension given to the file in your program, I would call it .txt as that is what it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 15:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314856#M21242</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-28T15:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a trailer with in the column positions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314891#M21243</link>
      <description>&lt;P&gt;Thanks RW9 for your suggestions, It is working &amp;nbsp;but I would like to know&amp;nbsp; how to give the positioning for header and trailer as starting and ending at the last column of the records .Could you please let me know , if I have a .txt file with 40+ columns .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex : header : AL16 (starging on the column &lt;STRONG&gt;Name&lt;/STRONG&gt;) &amp;nbsp;0000 ( ending on the column &lt;STRONG&gt;Id&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;Trailer &amp;nbsp;DL99 ( &lt;SPAN&gt;starging below&amp;nbsp;the column &lt;/SPAN&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;) &amp;nbsp; &amp;nbsp;0003 (count of records - &lt;SPAN&gt;ending below&amp;nbsp;the column &lt;/SPAN&gt;&lt;STRONG&gt;Id&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if _n_=1 then put "AL16             0000";
  put Name $ 1 - 17
      City $ 18 - 25
      Country $ 26 - 30
      Id $ 31 - 46;
  tmp="DL99             "||strip(put(num_obs,z3.));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Madhu&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 17:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/314891#M21243</guid>
      <dc:creator>tvbMadhu</dc:creator>
      <dc:date>2016-11-28T17:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a trailer with in the column positions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/315151#M21265</link>
      <description>&lt;P&gt;Ah, ok, use the&amp;nbsp;@ to position the pointer at the place of the last variable:&lt;/P&gt;
&lt;PRE&gt;data have;
  name="Thomas"; city="New Jersy"; country="USA"; id="1000"; output;
  name="David"; city="New Jersy"; country="USA"; id="1005"; output;
run;

data _null_;
  set have nobs=num_obs end=last;
  file "s:\temp\rob\text.txt";
  if _n_=1 then put @1 "AL16" @31 "0000";
  put Name $ 1 - 17
      City $ 18 - 25
      Country $ 26 - 30
      Id $ 31 - 46;
  tmp=strip(put(num_obs,z3.));
  if last then put @1 "DL99" @31 tmp;
run;
  &lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2016 11:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/315151#M21265</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-29T11:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a trailer with in the column positions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/315374#M21278</link>
      <description>Awesome !! Thanks RW9 its working..&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Nov 2016 23:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-create-a-trailer-with-in-the-column-positions/m-p/315374#M21278</guid>
      <dc:creator>tvbMadhu</dc:creator>
      <dc:date>2016-11-29T23:54:00Z</dc:date>
    </item>
  </channel>
</rss>

