<?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 How to read last few records into a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537965#M148048</link>
    <description>&lt;P&gt;I want to import a file and in that file&amp;nbsp; I want to read only last 10 records (not sure how many &lt;STRONG&gt;observation/records&lt;/STRONG&gt; we have in that file)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance..&lt;/P&gt;</description>
    <pubDate>Sat, 23 Feb 2019 12:40:10 GMT</pubDate>
    <dc:creator>vThanu</dc:creator>
    <dc:date>2019-02-23T12:40:10Z</dc:date>
    <item>
      <title>How to read last few records into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537965#M148048</link>
      <description>&lt;P&gt;I want to import a file and in that file&amp;nbsp; I want to read only last 10 records (not sure how many &lt;STRONG&gt;observation/records&lt;/STRONG&gt; we have in that file)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance..&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 12:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537965#M148048</guid>
      <dc:creator>vThanu</dc:creator>
      <dc:date>2019-02-23T12:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read last few records into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537966#M148049</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set sashelp.class nobs=nobs;
 if _n_&amp;gt;nobs-10 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Feb 2019 12:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537966#M148049</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-02-23T12:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read last few records into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537967#M148050</link>
      <description>&lt;P&gt;After import, SAS knows the record number:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set imported nobs=all_obs;
if _n_ &amp;gt; all_obs - 10;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you absolutely want to do it in the import data step, you can use an external command:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "wc -l &amp;amp;filename.";

data _null_;
infile oscmd;
input lines;
call symputx('lines',lines);
run;

data want;
infile "&amp;amp;filename." /* other options */;
input
........
;
if _n_ &amp;gt; &amp;amp;lines. - 10;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Feb 2019 13:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-last-few-records-into-a-dataset/m-p/537967#M148050</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-23T13:06:13Z</dc:date>
    </item>
  </channel>
</rss>

