<?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: sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628178#M185565</link>
    <description>&lt;P&gt;Do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set bm end=last;
    if _N_=1 or last;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Feb 2020 10:24:16 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-02-28T10:24:16Z</dc:date>
    <item>
      <title>sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628177#M185564</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data bm;&lt;BR /&gt;input id sex$ age;&lt;BR /&gt;cards;&lt;BR /&gt;10 m 45&lt;BR /&gt;11 m 12&lt;BR /&gt;12 f 25&lt;BR /&gt;13 f 30&lt;BR /&gt;14 m 14&lt;BR /&gt;15 f 30&lt;BR /&gt;16 m 41&lt;BR /&gt;17 f 19&lt;BR /&gt;18 f 21&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;i need only first observation and last observation by using first.last.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and advance&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 10:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628177#M185564</guid>
      <dc:creator>nayab_shaik</dc:creator>
      <dc:date>2020-02-28T10:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628178#M185565</link>
      <description>&lt;P&gt;Do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set bm end=last;
    if _N_=1 or last;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 10:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628178#M185565</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-28T10:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628179#M185566</link>
      <description>&lt;P&gt;Or..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    p=1; set bm point=p;        output;
    set bm nobs=nobs point=nobs;output;
    stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 10:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628179#M185566</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-28T10:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628183#M185568</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275954"&gt;@nayab_shaik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need the first / last observation BY groups &amp;nbsp;or for the overall dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;In case it is "by group", you will need:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1- To sort the data:&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=bm;
	by sex age;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2- To use the first/last flag to select the data. The "BY" statement identifies the 'groups' and create 2 internal variables: last. first.&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set bm;
	by sex age;
	if first.sex or last.sex then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-&amp;gt; in the following example, you will gather the youngest and the oldest men, and the youngest and the oldest women.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 10:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas/m-p/628183#M185568</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-28T10:37:15Z</dc:date>
    </item>
  </channel>
</rss>

