<?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: update an exist text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368440#M87877</link>
    <description>Windows,how to do that?</description>
    <pubDate>Mon, 19 Jun 2017 18:50:45 GMT</pubDate>
    <dc:creator>GeorgeSAS</dc:creator>
    <dc:date>2017-06-19T18:50:45Z</dc:date>
    <item>
      <title>update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368401#M87861</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can use data _null_; file filename to update/overwrite an txt file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also I can use mod option &amp;nbsp;to append to text file.here is the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename old "c:\temp\test\old";
data _null_;
file old;
put 'this is row 1';
put 'this is row 2';
put 'this is row 3';
put 'this is row 4';
put 'this is row 5';
put 'this is row 6';
put 'this is row 7';
put 'this is row 8';
put 'this is row 9';
put 'this is row 10';
run;
&amp;nbsp;
data a;
new="I want row number 6 to be updated";
run;

data _null_;
set a;
file old mod ;
put new;
run;&lt;/PRE&gt;
&lt;P&gt;the result of old is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is row 1&lt;BR /&gt;this is row 2&lt;BR /&gt;this is row 3&lt;BR /&gt;this is row 4&lt;BR /&gt;this is row 5&lt;BR /&gt;this is row 6&lt;BR /&gt;this is row 7&lt;BR /&gt;this is row 8&lt;BR /&gt;this is row 9&lt;BR /&gt;this is row 10&lt;BR /&gt;I want row number 6 to be updated&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;
&lt;P&gt;My question is I don't want string new append on the old file, I want the string new update the 6th row&amp;nbsp;of old file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the result should like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is row 1&lt;BR /&gt;this is row 2&lt;BR /&gt;this is row 3&lt;BR /&gt;this is row 4&lt;BR /&gt;this is row 5&lt;BR /&gt;I want row number 6 to be updated&lt;BR /&gt;this is row 7&lt;BR /&gt;this is row 8&lt;BR /&gt;this is row 9&lt;BR /&gt;this is row 10&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 17:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368401#M87861</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2017-06-19T17:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368403#M87862</link>
      <description>&lt;P&gt;What's your OS? It's best, IMO, to use either Unix or Windows line commands to do this rather than to use SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do you have XCMD enabled?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 17:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368403#M87862</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T17:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368440#M87877</link>
      <description>Windows,how to do that?</description>
      <pubDate>Mon, 19 Jun 2017 18:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368440#M87877</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2017-06-19T18:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368458#M87879</link>
      <description>&lt;P&gt;Search "Powershell replace line item in text file" for starters. I had this issue and posted this question earlier this year, so if you can search my questions you should see a similar answer on here.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 19:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368458#M87879</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T19:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368463#M87882</link>
      <description>&lt;P&gt;You could do it with just using SAS. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename old "c:\temp\test\old.txt";
data _null_;
  file old;
  put 'this is row 1';
  put 'this is row 2';
  put 'this is row 3';
  put 'this is row 4';
  put 'this is row 5';
  put 'this is row 6';
  put 'this is row 7';
  put 'this is row 8';
  put 'this is row 9';
  put 'this is row 10';
run;
 
data a;
  new="I want row number 6 to be updated";
run;

data have;
  infile old dsd truncover;
  input text $100.;
run;

data _null_;
  set have;
  if _n_ eq 1 then set a;
  if _n_ eq 6 then text=new;
  file old;
  put text;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 19:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368463#M87882</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-19T19:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368488#M87894</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;that requires you to process the entire file, the command line tools are more powerful, but it is a different language...&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 20:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368488#M87894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T20:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368517#M87901</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: I agree! But, for a small file requiring such a minor one-time change, I think the learning curve would cost more than the processing time required by the method I suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 22:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368517#M87901</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-19T22:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368518#M87902</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: I agree! But, for a small file requiring such a minor one-time change, I think the learning curve would cost more than the processing time required by the method I suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;100% agree, but there's also the logic if you never take the time to learn it, it will never be the faster method. Up to the OP to make that decision really at the end of the day. I wish I'd spent more time learning command line tools at the beginning of my career, they're the fast for manipulating text files and really powerful.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 22:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368518#M87902</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T22:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368567#M87917</link>
      <description>&lt;P&gt;Have you looked at the &lt;FONT face="courier new,courier"&gt;sharebuffers&lt;/FONT&gt; option?&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm#p1wh3af3k9jgzyn1w0agtn3uj2ed" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm#p1wh3af3k9jgzyn1w0agtn3uj2ed&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 03:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368567#M87917</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-20T03:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: update an exist text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368858#M87981</link>
      <description>I agree with both of you!</description>
      <pubDate>Tue, 20 Jun 2017 18:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-an-exist-text-file/m-p/368858#M87981</guid>
      <dc:creator>GeorgeSAS</dc:creator>
      <dc:date>2017-06-20T18:16:21Z</dc:date>
    </item>
  </channel>
</rss>

