<?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 count multiple records to mark this obs as &amp;quot;multiple visit&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-multiple-records-to-mark-this-obs-as-quot-multiple/m-p/289655#M59830</link>
    <description>&lt;P&gt;Assuming that your PROC SORT is doing the correct thing by removing multiple visits for the same patient on the same date ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try creating INDEX this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if first.id and last.id then index='Just one';&lt;/P&gt;
&lt;P&gt;else index='Multiple';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then adjust the WHERE statement to select whichever patients you would like.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2016 20:34:03 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-08-04T20:34:03Z</dc:date>
    <item>
      <title>how to count multiple records to mark this obs as "multiple visit"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-multiple-records-to-mark-this-obs-as-quot-multiple/m-p/289639#M59828</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have nodupkey;

by id date;

run;

data want;

set have;

by id date;

if first.id then index=1; else index=2;

run;

proc freq data=want;

tables cat1*cat2;

where index=1;

run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I prevoiusly used index=2 to mark if those obs have multiple records (visits). But this has limitation, only the later visits are counted. This time I need to mark, if the patient has mulitple visit (might see doctors same day many times), whether it is the first visit, or the later visit, I want to create a variable that the patient has "multiple visit"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means, if index=2, all the patient's records will mark as "multipe visit"&lt;/P&gt;
&lt;P&gt;Any idea how to do? Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 19:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-multiple-records-to-mark-this-obs-as-quot-multiple/m-p/289639#M59828</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-08-04T19:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to count multiple records to mark this obs as "multiple visit"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-multiple-records-to-mark-this-obs-as-quot-multiple/m-p/289655#M59830</link>
      <description>&lt;P&gt;Assuming that your PROC SORT is doing the correct thing by removing multiple visits for the same patient on the same date ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try creating INDEX this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if first.id and last.id then index='Just one';&lt;/P&gt;
&lt;P&gt;else index='Multiple';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then adjust the WHERE statement to select whichever patients you would like.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 20:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-multiple-records-to-mark-this-obs-as-quot-multiple/m-p/289655#M59830</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-04T20:34:03Z</dc:date>
    </item>
  </channel>
</rss>

