<?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: Proc Import csv but need to delete last line in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-csv-but-need-to-delete-last-line/m-p/357998#M84094</link>
    <description>&lt;P&gt;Here is one possible solution: replace the first two lines of your script:&lt;/P&gt;
&lt;PRE&gt;proc import 
   datafile="c:\temp\input.csv"
&lt;/PRE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;PRE&gt;filename FT16F001 temp; 
data _null_; 
  infile "c:\temp\input.csv";
  file FT16F001;
  input; 
  if _infile_ eq: 'Elapsed' then stop; 
  put _infile_; 
run;&lt;BR /&gt;
proc import 
   datafile=FT16F001
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2017 17:36:47 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-05-11T17:36:47Z</dc:date>
    <item>
      <title>Proc Import csv but need to delete last line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-csv-but-need-to-delete-last-line/m-p/357977#M84090</link>
      <description>&lt;P&gt;Have a script that works great&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc import 
   datafile="c:\temp\input.csv"
   replace
   /*
   out command below only keeps what var columns you need for data - missing vars
   represent empty columns 
   */
   out = data_read (keep = var1 var2 var4 var5 var11 var12)
   dbms=csv
   out=t2
   ;
   guessingrows=32767
   ;
   *getnames=yes - pulls the header names, only use if csv has headers 
   namerow will also tell you what line to get the names if necessary;
   getnames=no
   ;
   *Firstobs=9;
   *datarow tells you what line to start;
   datarow=9
   ;
   DELIMITER=' '
   ;
run ;
proc contents ;
run ;
proc print ;
run ;
proc export
   data=t2
   outfile="C:\temp\output.csv"
   dbms=csv
   replace
;
run ;&lt;/PRE&gt;&lt;P&gt;The problem is that the the input.csv file now contains&amp;nbsp;the following statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;"&amp;nbsp;Elapsed: 00:14:43.61," at the end of the file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I am looking for&amp;nbsp;way to delete the last line or find a way to delete&amp;nbsp;rows that beging with&amp;nbsp;"elapsed"&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 16:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-csv-but-need-to-delete-last-line/m-p/357977#M84090</guid>
      <dc:creator>hondahawkrider</dc:creator>
      <dc:date>2017-05-11T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import csv but need to delete last line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-csv-but-need-to-delete-last-line/m-p/357998#M84094</link>
      <description>&lt;P&gt;Here is one possible solution: replace the first two lines of your script:&lt;/P&gt;
&lt;PRE&gt;proc import 
   datafile="c:\temp\input.csv"
&lt;/PRE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;PRE&gt;filename FT16F001 temp; 
data _null_; 
  infile "c:\temp\input.csv";
  file FT16F001;
  input; 
  if _infile_ eq: 'Elapsed' then stop; 
  put _infile_; 
run;&lt;BR /&gt;
proc import 
   datafile=FT16F001
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 17:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-csv-but-need-to-delete-last-line/m-p/357998#M84094</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-11T17:36:47Z</dc:date>
    </item>
  </channel>
</rss>

