<?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: How do I fetch specific record from a given sas dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658318#M197303</link>
    <description>SAS supports indexing to allow for efficient data retrieval. If you need to extract records by varying criteria you may want to add in some indexes to support your queries.</description>
    <pubDate>Sun, 14 Jun 2020 02:14:07 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-06-14T02:14:07Z</dc:date>
    <item>
      <title>How do I fetch specific record from a given sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658304#M197298</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;From a given SAS Dataset, how can I fetch last but one record or third record from the last without doing hard coding. I don't want to do hard coding the values as the number of observations keep on changing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TIA.&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;</description>
      <pubDate>Sun, 14 Jun 2020 00:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658304#M197298</guid>
      <dc:creator>VVDR</dc:creator>
      <dc:date>2020-06-14T00:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch specific record from a given sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658307#M197301</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79200"&gt;@VVDR&lt;/a&gt;&amp;nbsp; Using SASHELP.CLASS dataset that has 19 records, here is an illustration-&lt;/P&gt;
&lt;P&gt;The comments should make sense to you&lt;/P&gt;
&lt;P&gt;/*last but one=numofrecs-1,third=last minus 2 records*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
/*last but one=numofrecs-1,third=last minus 2 records*/
 do _n_= nobs-1, nobs-2;
  set sashelp.class nobs=nobs point=_n_;
  output;
 end;
 stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jun 2020 01:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658307#M197301</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-14T01:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch specific record from a given sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658308#M197302</link>
      <description>&lt;P&gt;Are these assignment questions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here one way to get what the question asked for. The code below selects the 3rd last column.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n_obs_from_last=3;
data want;
  obs=nobs -&amp;amp;n_obs_from_last +1;
  if obs&amp;gt;0 then
    do;
      set sashelp.class nobs=nobs point=obs;
      output;
    end;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jun 2020 01:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658308#M197302</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-14T01:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch specific record from a given sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658318#M197303</link>
      <description>SAS supports indexing to allow for efficient data retrieval. If you need to extract records by varying criteria you may want to add in some indexes to support your queries.</description>
      <pubDate>Sun, 14 Jun 2020 02:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-fetch-specific-record-from-a-given-sas-dataset/m-p/658318#M197303</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-14T02:14:07Z</dc:date>
    </item>
  </channel>
</rss>

