<?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: Clear contents of csv file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792797#M254035</link>
    <description>&lt;P&gt;You can do it with a datastep, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csvfile '&amp;lt;path to file&amp;gt;';

data _null_;
  file csvfile old;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By specifying the OLD disposition for the file and writing nothing to it, it gets cleared.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jan 2022 10:19:17 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2022-01-27T10:19:17Z</dc:date>
    <item>
      <title>Clear contents of csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792793#M254031</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I clear contents of a csv file? I dont want it to delete the file, instead it must just empty the file so that I have a blank file.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 10:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792793#M254031</guid>
      <dc:creator>Citrine10</dc:creator>
      <dc:date>2022-01-27T10:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Clear contents of csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792796#M254034</link>
      <description>&lt;P&gt;Just create it anew with the FILE statement in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.class;
file "~/test.csv" dlm=",";
put name sex age;
run;

data _null_;
length fref $8;
rc = filename(fref,"~/test.csv");
fid = fopen(fref);
do i = 1 to foptnum(fid);
  optname = foptname(fid,i);
  infitem = finfo(fid,optname);
  put optname "=" infitem;
end;
rc = fclose(fid);
rc = filename(fref);
run;

data _null_;
file "~/test.csv";
run;

data _null_;
length fref $8;
rc = filename(fref,"~/test.csv");
fid = fopen(fref);
do i = 1 to foptnum(fid);
  optname = foptname(fid,i);
  infitem = finfo(fid,optname);
  put optname "=" infitem;
end;
rc = fclose(fid);
rc = filename(fref);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jan 2022 10:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792796#M254034</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-27T10:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Clear contents of csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792797#M254035</link>
      <description>&lt;P&gt;You can do it with a datastep, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csvfile '&amp;lt;path to file&amp;gt;';

data _null_;
  file csvfile old;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By specifying the OLD disposition for the file and writing nothing to it, it gets cleared.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 10:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clear-contents-of-csv-file/m-p/792797#M254035</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-01-27T10:19:17Z</dc:date>
    </item>
  </channel>
</rss>

