<?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 How to get number of patients in each adverse event? Proc Tabulate? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60933#M17279</link>
    <description>Hi&lt;BR /&gt;
I need to generate output that looks like this (number of patients and number of events per each event)&lt;BR /&gt;
&lt;BR /&gt;
	         # patients	# events&lt;BR /&gt;
Bleeding 	      10	14&lt;BR /&gt;
Stroke	               8	12&lt;BR /&gt;
etc 		&lt;BR /&gt;
&lt;BR /&gt;
How can proc tabulate help me do this? So far i only know how to get the #events per event type.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: sareenk

Message was edited by: sareenk</description>
    <pubDate>Fri, 31 Jul 2009 16:54:11 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-07-31T16:54:11Z</dc:date>
    <item>
      <title>How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60933#M17279</link>
      <description>Hi&lt;BR /&gt;
I need to generate output that looks like this (number of patients and number of events per each event)&lt;BR /&gt;
&lt;BR /&gt;
	         # patients	# events&lt;BR /&gt;
Bleeding 	      10	14&lt;BR /&gt;
Stroke	               8	12&lt;BR /&gt;
etc 		&lt;BR /&gt;
&lt;BR /&gt;
How can proc tabulate help me do this? So far i only know how to get the #events per event type.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: sareenk

Message was edited by: sareenk</description>
      <pubDate>Fri, 31 Jul 2009 16:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60933#M17279</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-31T16:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60934#M17280</link>
      <description>what is the structure of the data set you start with?</description>
      <pubDate>Fri, 31 Jul 2009 17:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60934#M17280</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-07-31T17:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60935#M17281</link>
      <description>the structure of my dataset is that it is in long format, meaning i have multiple rows per patient with the corresponding event type.</description>
      <pubDate>Fri, 31 Jul 2009 18:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60935#M17281</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-31T18:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60936#M17282</link>
      <description>A mini-sample would help. If your data looked like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
Patient Event    Date&lt;BR /&gt;
alan    bleeding 12/10/08&lt;BR /&gt;
alan    stroke   12/12/08&lt;BR /&gt;
alan    bleeding 12/14/08&lt;BR /&gt;
bob     stroke   12/15/08&lt;BR /&gt;
bob     stroke   12/18/08&lt;BR /&gt;
carl    bleeding 12/16/08&lt;BR /&gt;
carl    stroke   12/17/08&lt;BR /&gt;
dan     bleeding 12/19/08&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
What would you expect to see?&lt;BR /&gt;
                    &lt;BR /&gt;
[pre]&lt;BR /&gt;
One possibility:&lt;BR /&gt;
Event     NumPT    NumEv&lt;BR /&gt;
Bleeding    4        4    (alan counted twice)&lt;BR /&gt;
Stroke      4        4    (bob counted twice)&lt;BR /&gt;
                                 &lt;BR /&gt;
Another Possibility:&lt;BR /&gt;
Event     NumUniquePT   NumEv&lt;BR /&gt;
Bleeding    3            4    (alan counted once)&lt;BR /&gt;
Stroke      3            4    (bob counted once)&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                  &lt;BR /&gt;
Or perhaps you have other report requirements???&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 31 Jul 2009 20:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60936#M17282</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-07-31T20:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60937#M17283</link>
      <description>Yes, it would need to look like the second possibility, like this:&lt;BR /&gt;
&lt;BR /&gt;
Bleeding: #patients: 3    # bleeding events: 4&lt;BR /&gt;
Stroke     #patients: 3     # stroke events: 4&lt;BR /&gt;
&lt;BR /&gt;
Since 4 strokes are hapening in 3 patients, and so on. &lt;BR /&gt;
Does proc tabulate do this for me? &lt;BR /&gt;
Currently, the way I do this is i say&lt;BR /&gt;
&lt;BR /&gt;
data pts;&lt;BR /&gt;
if first.patcode;&lt;BR /&gt;
by patcode;&lt;BR /&gt;
where event='Bleeding';&lt;BR /&gt;
run;&lt;BR /&gt;
etc for each event I have. &lt;BR /&gt;
I am looking for a more concise method&lt;BR /&gt;
&lt;BR /&gt;
Thank you</description>
      <pubDate>Fri, 31 Jul 2009 22:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60937#M17283</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-31T22:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60938#M17284</link>
      <description>Hi:&lt;BR /&gt;
  With a little data "preparation", you can create the report you want with PROC TABULATE. Essentially, you need to make a numeric variable whose value will be 1 or 0 depending on whether you want to count the patient or not -- for a particular patient/event combination. &lt;BR /&gt;
&lt;BR /&gt;
This program assumes that the events are all going to be spelled exactly the same. In other words, stroke will ALWAYS be "stroke" and not "stroke" for one obs and "strke" for another obs and "strokes" for another obs.&lt;BR /&gt;
 &lt;BR /&gt;
The new variable, COUNTTHIS, will be used as an analysis variable by PROC TABULATE. EVENT will be placed in the row dimension of the table and COUNTTHIS and N will be in the column dimension of the table.&lt;BR /&gt;
 &lt;BR /&gt;
This program assumes that the data already exists in the PT_EVENT data set.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=pt_event;&lt;BR /&gt;
by patient event;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
ods listing;&lt;BR /&gt;
data uniq_pte;&lt;BR /&gt;
  set pt_event;&lt;BR /&gt;
  by patient event;&lt;BR /&gt;
  if first.event then countthis = 1;&lt;BR /&gt;
     else countthis = 0;&lt;BR /&gt;
run;&lt;BR /&gt;
                     &lt;BR /&gt;
** Print just to show result of using FIRST.EVENT;&lt;BR /&gt;
proc print data=uniq_pte;&lt;BR /&gt;
title 'Create Variable to Count Unique Patients for Each Event';&lt;BR /&gt;
title2 '(Only the first event for every unique patient/event combo';&lt;BR /&gt;
title3 'will get a 1 in order to be counted.)';&lt;BR /&gt;
format date mmddyy10.;&lt;BR /&gt;
run;&lt;BR /&gt;
                                &lt;BR /&gt;
proc tabulate data=uniq_pte f=comma8.;&lt;BR /&gt;
  title 'Use Proc Tabulate';&lt;BR /&gt;
  class event;&lt;BR /&gt;
  var countthis;&lt;BR /&gt;
  table event all='Total',&lt;BR /&gt;
        countthis="Number Unique Patients" n="Number Events";&lt;BR /&gt;
  keylabel sum = ' ';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 31 Jul 2009 23:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60938#M17284</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-07-31T23:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get number of patients in each adverse event? Proc Tabulate?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60939#M17285</link>
      <description>Thank you so much for your help, it worked! If I knew this forum was so helpful I would have asked about this a few years ago!&lt;BR /&gt;
A million thanks!</description>
      <pubDate>Mon, 03 Aug 2009 15:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-number-of-patients-in-each-adverse-event-Proc/m-p/60939#M17285</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-03T15:08:21Z</dc:date>
    </item>
  </channel>
</rss>

