<?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 to output just the last observation in a group in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510251#M1912</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I found some of my classmates are asking for the same question too. I know this looks stupid.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Indeed, it does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your presumed classmates have been&amp;nbsp;posting essentially the same homework again and again during&amp;nbsp;the past 48 hours:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Reading-multiple-records-into-one-observation/m-p/509984#M1862" target="_blank"&gt;Reading multiple records into one observation&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly-in-SAS/m-p/510123#M137257" target="_blank"&gt;How do i read these data correctly in SAS?&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244279"&gt;@Makmatt&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Studio/How-to-create-a-SAS-data-set-that-contains-only-the-last-record/m-p/510138#M6491" target="_blank"&gt;How to create a SAS data set that contains only the last record of each object ?&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243512"&gt;@Kitty28&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-variables-from-existing-variables/m-p/510163#M137275" target="_blank"&gt;Creating variables from existing variables&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;&amp;nbsp;again)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-output-the-last-part-data-programming/m-p/510172#M137279" target="_blank"&gt;How to output the last part (data programming)&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243976"&gt;@kennyA&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-variables-from-existing-variables/m-p/510184#M137305" target="_blank"&gt;Single observation for each variable&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;&amp;nbsp;again!)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Doesn't it defeat the purpose of homework to&amp;nbsp;have&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;experts do it?&lt;/P&gt;
&lt;P&gt;What if your course instructors follow these threads?&lt;/P&gt;</description>
    <pubDate>Sun, 04 Nov 2018 15:26:13 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2018-11-04T15:26:13Z</dc:date>
    <item>
      <title>How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510240#M1902</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;here's the result I got from SAS:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp;5&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp;7&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp;8&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp;9&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how&amp;nbsp;to&amp;nbsp;output it like this:&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp;6&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 12:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510240#M1902</guid>
      <dc:creator>ywhui9</dc:creator>
      <dc:date>2018-11-04T12:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510241#M1903</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by id;
    if last.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Nov 2018 13:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510241#M1903</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-04T13:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510242#M1904</link>
      <description>&lt;P&gt;Thanks for your reply it works but can we make it without using proc sort and set statement?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 13:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510242#M1904</guid>
      <dc:creator>ywhui9</dc:creator>
      <dc:date>2018-11-04T13:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510243#M1905</link>
      <description>&lt;P&gt;but what is problem with sort and set statement. That is clean and easiest way to say. if you data is always in that order that your max id is last record then you can do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from have
group by id
having othercolumn = max(othercolumn);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 13:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510243#M1905</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-04T13:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510244#M1906</link>
      <description>&lt;P&gt;set statement is totally fine and I understand it is the easiest way but I'm actually doing an assignment and we're told to solve this by using if-then, retain, output statement etc. Thanks tho!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 13:53:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510244#M1906</guid>
      <dc:creator>ywhui9</dc:creator>
      <dc:date>2018-11-04T13:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510245#M1907</link>
      <description>&lt;P&gt;I don't understand this? Do you want to use&amp;nbsp;&lt;SPAN&gt;if-then, retain &lt;STRONG&gt;and&lt;/STRONG&gt;&amp;nbsp;an output statement?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to avoid sorting and you know that the data is already grouped, you could do&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $ var;
datalines;
A 10
B 5
B 6
C 7
C 8
C 9
C 10
D 2
;

data want;
   set have;
   by ID notsorted;
   if last.ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Nov 2018 14:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510245#M1907</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-04T14:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510246#M1908</link>
      <description>&lt;P&gt;If you had to, you could load the data into a hash table (using methods that replace previously found values) and then unload the result into a data set.&amp;nbsp; But why use a sledgehammer to kill a fly?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 14:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510246#M1908</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-04T14:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510247#M1909</link>
      <description>&lt;P&gt;If you had to, you could load the data into a hash table (using methods that replace previously found values) and then unload the result into a data set.&amp;nbsp; But why use a sledgehammer to kill a fly?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 14:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510247#M1909</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-04T14:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510248#M1910</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your reply it works but can we make it without using proc sort and set statement?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to explain further what you are doing, and WHY you don't want to use PROC SORT and the SET statement. The code is written a certain way for a reason (simplicity, directness); and without a good reason (which you have not specified), you are asking for a lot of unnecessary complications.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 14:37:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510248#M1910</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-04T14:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510250#M1911</link>
      <description>&lt;P&gt;Sorry guys, I don't want to enclose too much detail (e.g. my codes) as I found some of my classmates are asking for the same question too. I know this looks stupid. I'm going to find out the solution myself. Thanks for all replies! Have a nice day!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 15:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510250#M1911</guid>
      <dc:creator>ywhui9</dc:creator>
      <dc:date>2018-11-04T15:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510251#M1912</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I found some of my classmates are asking for the same question too. I know this looks stupid.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Indeed, it does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your presumed classmates have been&amp;nbsp;posting essentially the same homework again and again during&amp;nbsp;the past 48 hours:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Reading-multiple-records-into-one-observation/m-p/509984#M1862" target="_blank"&gt;Reading multiple records into one observation&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly-in-SAS/m-p/510123#M137257" target="_blank"&gt;How do i read these data correctly in SAS?&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244279"&gt;@Makmatt&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Studio/How-to-create-a-SAS-data-set-that-contains-only-the-last-record/m-p/510138#M6491" target="_blank"&gt;How to create a SAS data set that contains only the last record of each object ?&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243512"&gt;@Kitty28&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-variables-from-existing-variables/m-p/510163#M137275" target="_blank"&gt;Creating variables from existing variables&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;&amp;nbsp;again)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-output-the-last-part-data-programming/m-p/510172#M137279" target="_blank"&gt;How to output the last part (data programming)&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243976"&gt;@kennyA&lt;/a&gt;)&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-variables-from-existing-variables/m-p/510184#M137305" target="_blank"&gt;Single observation for each variable&lt;/A&gt;&amp;nbsp;(by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/244119"&gt;@blowsnow__&lt;/a&gt;&amp;nbsp;again!)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Doesn't it defeat the purpose of homework to&amp;nbsp;have&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;experts do it?&lt;/P&gt;
&lt;P&gt;What if your course instructors follow these threads?&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 15:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510251#M1912</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-04T15:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510253#M1913</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8497"&gt;@Reinhard&lt;/a&gt; That’s why I didn’t post any detail regarding the assignment. I put my code here in my last post because I had been working for many hours and I was almost done. It was about the timing of using an output statement and thanks some of you for pointing out the problem of my code. This time the same I didn’t want to ask for the answer directly but you think I did i’m sorry. I have no friends in this class so I have no idea about what they did before sorry for annoying you. I’ll ask the the same thing to my prof too if it is not weekend so indeed I don’t care whether my prof is following this post or not. Thanks for your reply tho.</description>
      <pubDate>Sun, 04 Nov 2018 15:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510253#M1913</guid>
      <dc:creator>ywhui9</dc:creator>
      <dc:date>2018-11-04T15:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510256#M1914</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;: No problem, sorry, wasn't meant to be rude. Now I see, you just needed the last missing piece to the puzzle. That's fine. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;&amp;nbsp;wrote: I have no friends in this class ...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sad to read this. Luckily, this forum is full of nice people who spend a lot of their free time helping other members with their SAS (and statistics) questions. It's a great place for learning SAS (which is actually a never-ending task) because you can see how problems of all levels are tackled by experts with various backgrounds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck with your SAS course and happy learning!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Nov 2018 16:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510256#M1914</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-04T16:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to output just the last observation in a group</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510265#M1915</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/243889"&gt;@ywhui9&lt;/a&gt;&amp;nbsp; Interesting that a group of your classmates have found this amazing SAS family(our communities) while my&amp;nbsp;mates are still pondering how to ask a clear question here. Plus, one of your questions(summary in one step that involved &lt;U&gt;&lt;STRONG&gt;Look ahead&lt;/STRONG&gt;&lt;/U&gt;) was something I personally enjoyed answering.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To your&lt;EM&gt;-"&amp;nbsp;we're told to solve this by using &lt;STRONG&gt;if-then, retain, output&lt;/STRONG&gt; statement etc"&lt;/EM&gt;&amp;nbsp;(supposing that's for extra credit?)&amp;nbsp; add some flavor to astounding idea of hash replace the found previous values in this thread&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $ var;
datalines;
A 10
B 5
B 6
C 7
C 8
C 9
C 10
D 2
;

data _null_;
   dcl hash H (dataset:'have',ordered: "a",duplicate:'r') ;
   h.definekey  ("id") ;
   h.definedata ("id", "var") ;
   h.definedone () ;
h.output(dataset:'want');
stop;
retain _n_ _iorc_ ;
if 0 then do;set have;output;end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above may make&amp;nbsp;&amp;nbsp;professors may think we are naughty but works for extra credit :), but I have always been that since childhood. Have fun!&amp;nbsp;&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, 04 Nov 2018 19:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-output-just-the-last-observation-in-a-group/m-p/510265#M1915</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-04T19:01:41Z</dc:date>
    </item>
  </channel>
</rss>

