<?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 select the last observation from a dataset to perform a match-merge? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700795#M214509</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = Have;
  by SSN Visit_Date;
run;

data Want;
  set Have;
  by SSN;
  if last.SSN;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 22 Nov 2020 22:12:45 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2020-11-22T22:12:45Z</dc:date>
    <item>
      <title>How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700792#M214506</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working on performing a match-merge across four data sets. Each observation should include a unique SSN; however one dataset records four observations per one SSN. How would I go about including only the last recorded observation for each unique SSN to my final match-merged dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The observations for the data set in question would be structured similarly to:&lt;/P&gt;&lt;P&gt;111-11-1111 ...&lt;/P&gt;&lt;P&gt;111-11-1111 ...&lt;/P&gt;&lt;P&gt;111-11-1111 ...&lt;/P&gt;&lt;P&gt;111-11-1111 ...&lt;/P&gt;&lt;P&gt;222-22-2222 ...&lt;/P&gt;&lt;P&gt;222-22-2222 ...&lt;/P&gt;&lt;P&gt;222-22-2222 ...&lt;/P&gt;&lt;P&gt;222-22-2222 ...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 21:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700792#M214506</guid>
      <dc:creator>steeleye</dc:creator>
      <dc:date>2020-11-22T21:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700793#M214507</link>
      <description>&lt;P&gt;Do you have a recorded date in your data to sort on as well as SSN? If not how would you identify the last recorded SSN?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 21:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700793#M214507</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-22T21:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700794#M214508</link>
      <description>&lt;P&gt;Yes, there is a corresponding visit date for each observation. We are being asked to select the observation with the most recent visit date per SSN.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 22:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700794#M214508</guid>
      <dc:creator>steeleye</dc:creator>
      <dc:date>2020-11-22T22:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700795#M214509</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = Have;
  by SSN Visit_Date;
run;

data Want;
  set Have;
  by SSN;
  if last.SSN;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Nov 2020 22:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700795#M214509</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-22T22:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700855#M214541</link>
      <description>&lt;P&gt;Can you show us your code so far?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 08:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700855#M214541</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-23T08:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700952#M214588</link>
      <description>Thank you so much, this worked perfectly!</description>
      <pubDate>Mon, 23 Nov 2020 16:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700952#M214588</guid>
      <dc:creator>steeleye</dc:creator>
      <dc:date>2020-11-23T16:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to select the last observation from a dataset to perform a match-merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700957#M214590</link>
      <description>&lt;P&gt;No I'm sorry, this code is for a class so I cannot provide my code verbatim.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 16:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-the-last-observation-from-a-dataset-to-perform-a/m-p/700957#M214590</guid>
      <dc:creator>steeleye</dc:creator>
      <dc:date>2020-12-10T16:30:32Z</dc:date>
    </item>
  </channel>
</rss>

