<?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: write to a output file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549170#M152355</link>
    <description>&lt;P&gt;I think you need another data step. Add this after the step you have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME new1 "C:\temp\abc1.txt";
data _null_;    
  rc = fcopy('new','new1');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2019 21:34:12 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-04-08T21:34:12Z</dc:date>
    <item>
      <title>write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549154#M152345</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME new "C:\new\abc.txt";

 

data _null_;

  file new dsd dlm = ';';

  set atmdata;

  format txt $18.;

  by client_no atm_id;

  if _N_ = 1 then

    put 'name;'

        'ATM ;'

        'transacation_number;'

       

    ;

 

put client_no

     atm_id

     Transacation

    

     ;

 

 

run;

filename NEW;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am writing above code to write data set atmdata to a file new&lt;/P&gt;&lt;P&gt;Now I want same data set to be written into different directory&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILENAME new1 "D:\new1\abc.txt";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I do not want to write data statement again to write into different directory&lt;/P&gt;&lt;P&gt;Can i write two filename staemnet with one data step ?&lt;/P&gt;&lt;P&gt;How can i acheive that&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 03:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549154#M152345</guid>
      <dc:creator>shubham1</dc:creator>
      <dc:date>2019-04-08T03:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549161#M152350</link>
      <description>&lt;P&gt;You could probably do it with a loop but FCOPY is probably more efficient, which would copy the written file, which is faster than writing to two places.&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 have end=eof;




...rest of code;



if eof then do;
rc = fcopy(....);
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127952"&gt;@shubham1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME new "C:\new\abc.txt";

 

data _null_;

  file new dsd dlm = ';';

  set atmdata;

  format txt $18.;

  by client_no atm_id;

  if _N_ = 1 then

    put 'name;'

        'ATM ;'

        'transacation_number;'

       

    ;

 

put client_no

     atm_id

     Transacation

    

     ;

 

 

run;

filename NEW;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am writing above code to write data set atmdata to a file new&lt;/P&gt;
&lt;P&gt;Now I want same data set to be written into different directory&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;FILENAME new1 "D:\new1\abc.txt";&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I do not want to write data statement again to write into different directory&lt;/P&gt;
&lt;P&gt;Can i write two filename staemnet with one data step ?&lt;/P&gt;
&lt;P&gt;How can i acheive that&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 04:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549161#M152350</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-08T04:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549169#M152354</link>
      <description>&lt;P&gt;Can you give me a code as I am not able to get it how it should write&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 04:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549169#M152354</guid>
      <dc:creator>shubham1</dc:creator>
      <dc:date>2019-04-08T04:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549170#M152355</link>
      <description>&lt;P&gt;I think you need another data step. Add this after the step you have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME new1 "C:\temp\abc1.txt";
data _null_;    
  rc = fcopy('new','new1');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 21:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549170#M152355</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-08T21:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549171#M152356</link>
      <description>&lt;P&gt;Something like this should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

  set atmdata;

  format txt $18.;

  by client_no atm_id;

  file new dsd dlm = ';';
  link WriteFile;

  file new2 dsd dlm = ';';
  link WriteFile;

WriteFile:
  if _N_ = 1 then

    put 'name;'

        'ATM ;'

        'transacation_number;'

    ;

put client_no

     atm_id

     Transacation
     ;

return;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Apr 2019 04:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549171#M152356</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-04-08T04:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: write to a output file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549179#M152363</link>
      <description>&lt;P&gt;Thanks It worked now&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 05:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/write-to-a-output-file/m-p/549179#M152363</guid>
      <dc:creator>shubham1</dc:creator>
      <dc:date>2019-04-08T05:24:33Z</dc:date>
    </item>
  </channel>
</rss>

