<?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: keep selected records and count in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188185#M265831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jag's code is working for me. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jan 2014 23:15:27 GMT</pubDate>
    <dc:creator>peppapig</dc:creator>
    <dc:date>2014-01-08T23:15:27Z</dc:date>
    <item>
      <title>keep selected records and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188181#M265827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data Have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="832"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;ID&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;TIME&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q_TYPE&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q3&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q4&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q05&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q06&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q07&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q08&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q09&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;33&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;44&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;55&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;66&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;77&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;7&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="832"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;A02&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;B&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A03&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;55&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 896px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;ID&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; TIME&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q_TYPE&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q3&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q4&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q05&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q06&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q07&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q08&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q09&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Q10&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;COUNT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;55&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;77&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="896"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;A02&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;B&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;" width="64"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;A03&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;22&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;55&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each question&amp;nbsp; answered, keep the last answer according to the time, then count how many questions total answered for each Q_type.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188181#M265827</guid>
      <dc:creator>peppapig</dc:creator>
      <dc:date>2014-01-03T20:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: keep selected records and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188182#M265828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What have you already tried? What are your thoughts of how to approach this? Can you share some (may be not yet working) code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jan 2014 00:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188182#M265828</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-04T00:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: keep selected records and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188183#M265829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try the below code, producing the expecting output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;consider that you have data in the dataset have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id q_type time;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test(q);&lt;/P&gt;&lt;P&gt;data &amp;amp;q;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id q_type time;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &amp;amp;q. ne .;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep id time q_type &amp;amp;q.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;q._;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &amp;amp;q.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id q_type time;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.q_type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test2;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;%do i = 1 %to 10;&lt;/P&gt;&lt;P&gt;%test(q&amp;amp;i);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge q1_ q2_ q3_ q4_ q5_ q6_ q7_ q8_ q9_ q10_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id q_type ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = 10- nmiss(of q1-q10);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep&amp;nbsp; id q_type time count;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge q1_ q2_ q3_ q4_ q5_ q6_ q7_ q8_ q9_ q10_ count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id q_type time;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jan 2014 14:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188183#M265829</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-01-04T14:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: keep selected records and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188184#M265830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is one approach using Hash. If your RAM is not big enough to hold the whole table, some variation could be designed to load only one ID each time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id $ q_type $ q1-q10 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; time+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;+(lag(id) ne id)*(-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)*time;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A 33 . . . . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A 44 . . . . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A 55 . . . . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A . . . 88 . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A . . . 66 . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A . . . 77 . . . . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A . . . . . . 22 . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A01 A . . . . . . 11 . . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A02 B 1 1 . 2 . 2 . . . 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A03 C 22 . . 11 22 . . 22 55 88&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;declare&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;hash&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; h(dataset:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'have'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definekey(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'id'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'time'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definedata(all:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'y'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;declare&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;hash&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _t(ordered:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'a'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _t.definekey(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'time'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _t.definedata(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'time'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _t.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;declare&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;hiter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _ti(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'_t'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (last.id);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; q q1-q10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; t(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; q;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; not missing(q) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; t(_i_)=time;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; last.id &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ct=n(of t(*));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _i_=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; t(_i_) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; time=t(_i_); rc=_t.replace(); &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; rc=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _t.num_items;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ti.next();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; h.find();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; rc= _t.num_items &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; count=ct;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; missing (of t(*));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=_ti.next();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=_t.clear();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ct rc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2014 20:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188184#M265830</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-01-06T20:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: keep selected records and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188185#M265831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jag's code is working for me. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2014 23:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-selected-records-and-count/m-p/188185#M265831</guid>
      <dc:creator>peppapig</dc:creator>
      <dc:date>2014-01-08T23:15:27Z</dc:date>
    </item>
  </channel>
</rss>

