<?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: TO FInd the last  5th observation in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11532#M1381</link>
    <description>How about a more direct(access) approach?&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data input;&lt;BR /&gt;
   input CharColumn $;&lt;BR /&gt;
   obs + 1;&lt;BR /&gt;
   datalines;&lt;BR /&gt;
H090301&lt;BR /&gt;
C090302&lt;BR /&gt;
I090303&lt;BR /&gt;
H090304&lt;BR /&gt;
C090305&lt;BR /&gt;
I090306&lt;BR /&gt;
H090307&lt;BR /&gt;
C090308&lt;BR /&gt;
I090309&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
data last5;&lt;BR /&gt;
   do point=nobs-4 to nobs;&lt;BR /&gt;
      set input point=point nobs=nobs;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
*** OR just compute FIRSTOBS and start reading from there.&lt;BR /&gt;
proc sql NOPRINT;  &lt;BR /&gt;
   select nobs-4 into :firstobs separated ' ' &lt;BR /&gt;
      from sashelp.vtable  &lt;BR /&gt;
   where libname='WORK' and memname ='INPUT';&lt;BR /&gt;
   quit;&lt;BR /&gt;
%put FIRSTOBS=&amp;amp;firstobs;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=input(firstobs=&amp;amp;firstobs);&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 26 Mar 2009 16:52:36 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2009-03-26T16:52:36Z</dc:date>
    <item>
      <title>TO FInd the last  5th observation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11530#M1379</link>
      <description>I have a  Data set but i dont know the no of observations are there now i want the last 5 th observation.</description>
      <pubDate>Thu, 26 Mar 2009 11:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11530#M1379</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-26T11:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: TO FInd the last  5th observation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11531#M1380</link>
      <description>Here is one way of doing it.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data input(keep=CharColumn);&lt;BR /&gt;
input CharColumn $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
H090301&lt;BR /&gt;
C090302&lt;BR /&gt;
I090303&lt;BR /&gt;
H090304&lt;BR /&gt;
C090305&lt;BR /&gt;
I090306&lt;BR /&gt;
H090307&lt;BR /&gt;
C090308&lt;BR /&gt;
I090309&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
proc sql NOPRINT;&lt;BR /&gt;
  select nobs into :nobs&lt;BR /&gt;
  from sashelp.vtable&lt;BR /&gt;
  where libname='WORK' and memname ='INPUT';&lt;BR /&gt;
quit;&lt;BR /&gt;
%put &amp;amp;nobs;&lt;BR /&gt;
 &lt;BR /&gt;
data last5;&lt;BR /&gt;
  set input END=last;&lt;BR /&gt;
  if _n_ &amp;gt; (&amp;amp;nobs - 5) then output;&lt;BR /&gt;
run;[/pre]</description>
      <pubDate>Thu, 26 Mar 2009 12:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11531#M1380</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-03-26T12:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: TO FInd the last  5th observation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11532#M1381</link>
      <description>How about a more direct(access) approach?&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data input;&lt;BR /&gt;
   input CharColumn $;&lt;BR /&gt;
   obs + 1;&lt;BR /&gt;
   datalines;&lt;BR /&gt;
H090301&lt;BR /&gt;
C090302&lt;BR /&gt;
I090303&lt;BR /&gt;
H090304&lt;BR /&gt;
C090305&lt;BR /&gt;
I090306&lt;BR /&gt;
H090307&lt;BR /&gt;
C090308&lt;BR /&gt;
I090309&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
data last5;&lt;BR /&gt;
   do point=nobs-4 to nobs;&lt;BR /&gt;
      set input point=point nobs=nobs;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   stop;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
*** OR just compute FIRSTOBS and start reading from there.&lt;BR /&gt;
proc sql NOPRINT;  &lt;BR /&gt;
   select nobs-4 into :firstobs separated ' ' &lt;BR /&gt;
      from sashelp.vtable  &lt;BR /&gt;
   where libname='WORK' and memname ='INPUT';&lt;BR /&gt;
   quit;&lt;BR /&gt;
%put FIRSTOBS=&amp;amp;firstobs;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=input(firstobs=&amp;amp;firstobs);&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 26 Mar 2009 16:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/TO-FInd-the-last-5th-observation/m-p/11532#M1381</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-03-26T16:52:36Z</dc:date>
    </item>
  </channel>
</rss>

