<?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 Building output dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293731#M270165</link>
    <description>&lt;P&gt;I'm having some difficulty trying to create an output dataset in the format I want. Essentially I'm reading in a dataset, If that dataset is not empty than I would like to add some static commentary to my output, then write each record out. All I can get is the static output to repeat for each record, which I don't want. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;                                               
   set three;                                              
   file msg02;                                             
    put  '**********************************************' ;
    put  '*** blah 1                                       ***' ;
    put  '*** blah 2                                       ***' ;
    put  '*** blah 3                                        ***' ;
    put  '**********************************************' ;
   put @02 name @15 num @25 message;                 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hoping to see output like this –&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I removed the check for an empty file as I wasn't sure that wasn't causing me issues, so am just trying to get this to work for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC Print of the dataset using the title option gives me what I want, and I can redirect the SASLIST to a dataset, however I also still need it within my log output. If there is an option to have the SASLIST both redirected to a dataset and kept in the log that should also work for me, though I assume building it as above is probably the route to go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2016 14:21:42 GMT</pubDate>
    <dc:creator>serge68</dc:creator>
    <dc:date>2016-08-24T14:21:42Z</dc:date>
    <item>
      <title>Building output dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293731#M270165</link>
      <description>&lt;P&gt;I'm having some difficulty trying to create an output dataset in the format I want. Essentially I'm reading in a dataset, If that dataset is not empty than I would like to add some static commentary to my output, then write each record out. All I can get is the static output to repeat for each record, which I don't want. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;                                               
   set three;                                              
   file msg02;                                             
    put  '**********************************************' ;
    put  '*** blah 1                                       ***' ;
    put  '*** blah 2                                       ***' ;
    put  '*** blah 3                                        ***' ;
    put  '**********************************************' ;
   put @02 name @15 num @25 message;                 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hoping to see output like this –&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;Static Blah 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;Record 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I removed the check for an empty file as I wasn't sure that wasn't causing me issues, so am just trying to get this to work for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC Print of the dataset using the title option gives me what I want, and I can redirect the SASLIST to a dataset, however I also still need it within my log output. If there is an option to have the SASLIST both redirected to a dataset and kept in the log that should also work for me, though I assume building it as above is probably the route to go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 14:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293731#M270165</guid>
      <dc:creator>serge68</dc:creator>
      <dc:date>2016-08-24T14:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Building output dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293736#M270166</link>
      <description>&lt;P&gt;Sorry, thats not making sense to me. &amp;nbsp;You talk about building a dataset, but provide code which would create an output text file.&lt;/P&gt;
&lt;P&gt;If you want to print that header info only once, thenput an if around it:&lt;/P&gt;
&lt;PRE&gt;data _null_;                                               
   set three;                                              
   file msg02;
   if _n_=1 then do;                                             
    put  '**********************************************' ;
    put  '*** blah 1                                       ***' ;
    put  '*** blah 2                                       ***' ;
    put  '*** blah 3                                        ***' ;
    put  '**********************************************' ;
   end;
   put @02 name @15 num @25 message;      
run;&lt;/PRE&gt;
&lt;P&gt;However a quesiton arises why you want that kind of output, its not easy to process. &amp;nbsp;Lokos like its some sort of program header template? &amp;nbsp;The whole re-directing to dataset doesn't make sense.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 14:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293736#M270166</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-24T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Building output dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293745#M270167</link>
      <description>Sorry, by dataset I was referring to a ZOS/mainframe dataset(an output file) not a SAS dataset.&lt;BR /&gt;&lt;BR /&gt;What you gave me is exactly what I need.&lt;BR /&gt;&lt;BR /&gt;Appreciate it.</description>
      <pubDate>Wed, 24 Aug 2016 14:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Building-output-dataset/m-p/293745#M270167</guid>
      <dc:creator>serge68</dc:creator>
      <dc:date>2016-08-24T14:48:41Z</dc:date>
    </item>
  </channel>
</rss>

