i have data with three variables, hospital, patient, and bad_event. My desired result is a proc report table with hospital, N, and count of bad events.
the data looks like this
A 001 0
B 002 0
C 003 0
A 004 1
B 005 1
C 006 0
A 007 0
B 008 1
C 009 0
if i use the code below i get exactly what i want because the values for bad_event are 1 and 0.
proc report data=test; columns hospital n bad_event=bad_event_sum; define hospital/ group; define n / format=8.; define bad_event_sum/ sum; run;
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.