<?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: counting patient visits by patientid and age in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272495#M54208</link>
    <description>&lt;P&gt;What is the definition of a "visit"?&amp;nbsp; Is it any instance of utilization=1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, your DATA step is very close.&amp;nbsp; You refer to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first.patientid&lt;/P&gt;
&lt;P&gt;last.patientid&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you should be referring to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first.patage&lt;/P&gt;
&lt;P&gt;last.patage&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PROC MEANS approach could work (assuming that you add the missing semicolon).&amp;nbsp; But it would be safer to add a WHERE statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where utilization=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the one hand, that would protect against suspect values for UTILIZATION such as 2 or -1.&amp;nbsp; On the other hand, that would lead to further complications.&amp;nbsp; You would no longer get totals of 0 as part of the output.&amp;nbsp; It's probably safer to stick with the DATA step.&lt;/P&gt;</description>
    <pubDate>Mon, 23 May 2016 18:07:43 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-05-23T18:07:43Z</dc:date>
    <item>
      <title>counting patient visits by patientid and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272470#M54198</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; I need to create a count visits by patient and age.&amp;nbsp; I have attempted with the following syntax, but age is not counting correctly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data util_sum;&lt;BR /&gt;set asthma.household_female;&lt;BR /&gt;by patientid patage;&lt;BR /&gt;if first.patientid=1 then N_util=0;&lt;BR /&gt;if utilization=1 then N_util +1;&lt;BR /&gt;if last.patientid=1 then output;&lt;BR /&gt;keep patientid patage n_util;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried using proc means, but age is still not counting correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc means sum data=utilization&lt;BR /&gt;by patientid;&lt;BR /&gt;class patage;&lt;BR /&gt;var utilization;&lt;BR /&gt;output out=var_sum sum=;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help is greatly appreciated!!&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 17:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272470#M54198</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2016-05-23T17:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: counting patient visits by patientid and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272488#M54205</link>
      <description>&lt;P&gt;Please describe how "age is still not counting correctly".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may need to decide which AGE to use for a count as your patients age increases between visits. So do you want&lt;/P&gt;
&lt;P&gt;1) AGE at each visit and count each visit&lt;/P&gt;
&lt;P&gt;2) Count age only&amp;nbsp;at first visit&lt;/P&gt;
&lt;P&gt;3) Count age only at latest visit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide some example data and the desired result for that example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 17:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272488#M54205</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-23T17:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: counting patient visits by patientid and age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272495#M54208</link>
      <description>&lt;P&gt;What is the definition of a "visit"?&amp;nbsp; Is it any instance of utilization=1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, your DATA step is very close.&amp;nbsp; You refer to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first.patientid&lt;/P&gt;
&lt;P&gt;last.patientid&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you should be referring to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first.patage&lt;/P&gt;
&lt;P&gt;last.patage&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PROC MEANS approach could work (assuming that you add the missing semicolon).&amp;nbsp; But it would be safer to add a WHERE statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where utilization=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the one hand, that would protect against suspect values for UTILIZATION such as 2 or -1.&amp;nbsp; On the other hand, that would lead to further complications.&amp;nbsp; You would no longer get totals of 0 as part of the output.&amp;nbsp; It's probably safer to stick with the DATA step.&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 18:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-patient-visits-by-patientid-and-age/m-p/272495#M54208</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-23T18:07:43Z</dc:date>
    </item>
  </channel>
</rss>

