<?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 do i use PROC REPORT to count only certain observations? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475984#M71198</link>
    <description>&lt;P&gt;NO. I is hard for proc report.&lt;/P&gt;
&lt;P&gt;process the dataset firstly(add a new variable):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_bad_event=ifn(bad_event=0,0,1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After that run your code again ,using new_bad_event variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jul 2018 13:19:08 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-07-06T13:19:08Z</dc:date>
    <item>
      <title>How do i use PROC REPORT to count only certain observations?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475909#M71196</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have data with three&amp;nbsp;variables, hospital, patient, and bad_event.&amp;nbsp; My desired result is a proc report table with hospital, N, and count of bad events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the data looks like this&lt;/P&gt;&lt;P&gt;A 001 0&lt;/P&gt;&lt;P&gt;B 002 0&lt;/P&gt;&lt;P&gt;C 003 0&lt;/P&gt;&lt;P&gt;A 004 1&lt;/P&gt;&lt;P&gt;B 005 1&lt;/P&gt;&lt;P&gt;C 006 0&lt;/P&gt;&lt;P&gt;A 007 0&lt;/P&gt;&lt;P&gt;B 008 1&lt;/P&gt;&lt;P&gt;C 009 0&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;if i use the code below i get exactly what i want because the values for bad_event are 1 and 0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=test;&lt;BR /&gt;columns hospital n bad_event=bad_event_sum;&lt;BR /&gt;define hospital/ group;&lt;BR /&gt;define n / format=8.;&lt;BR /&gt;define bad_event_sum/ sum;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, instead of summing all of the bad_event values (ones and zeros), can i count all of the values that are not zero (for example)? i am asking because it is entirely possible that i will be given data where the values of bad_event will be, for example, 0,1,2,3,4. And in this case using sum will not work.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for any help that you can provide.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 06:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475909#M71196</guid>
      <dc:creator>the_sheriff</dc:creator>
      <dc:date>2018-07-06T06:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do i use PROC REPORT to count only certain observations?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475921#M71197</link>
      <description>&lt;P&gt;Do it in a datastep or procedure before hand, then use proc report as a reporting procedure only.&amp;nbsp; I never use a reporting procedure to do data manipulation.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 07:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475921#M71197</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-06T07:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do i use PROC REPORT to count only certain observations?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475984#M71198</link>
      <description>&lt;P&gt;NO. I is hard for proc report.&lt;/P&gt;
&lt;P&gt;process the dataset firstly(add a new variable):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_bad_event=ifn(bad_event=0,0,1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After that run your code again ,using new_bad_event variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 13:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-use-PROC-REPORT-to-count-only-certain-observations/m-p/475984#M71198</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-06T13:19:08Z</dc:date>
    </item>
  </channel>
</rss>

