I have a dataset like this
ID Issue Fixed
1 Issue 1 yes
2 Issue 2 no
3 Issue 3 yes
4 Issue 1 yes
4 Issue 3 no
5 Issue 1 no
5 Issue 2 yes
5 Issue 3 no
........
There are 3 Issues (Issue1-Issue3), Each id can fall into multiple issues.
I want to get a summary report like this. I tried Proc report, but I am not getting my desired output.
Issue Yes no Total
Issue 1 2 1 3
Issue 2 1 1 2
Issue 3 1 2 3
Thanks
@Kalai2008 wrote:
I have a dataset like this
ID Issue Fixed
1 Issue 1 yes
2 Issue 2 no
3 Issue 3 yes
4 Issue 1 yes
4 Issue 3 no
5 Issue 1 no
5 Issue 2 yes
5 Issue 3 no........
There are 5 Issues (Issue1-Issue5), Each id can fall into multiple issues.I want to get a summary report like this. I tried Proc report, but I am not getting my desired output.
Issue Yes no Total
Issue 1 2 1 3
Issue 2 1 1 2
Issue 3 1 2 3
Thanks
I see only 3 issues, not 5.
Show us your PROC REPORT code, and we should be able to help you fix it.
Sorry there are 3 Issues.
Proc report data=test;
column issue fixed id;
define issue/group;
run;
Not tested as no test data, but:
proc sql;
create table WANT as
select ISSUE,
sum(case when FIXED="yes" then 1 else 0 end) as YES,
sum(case when FIXED="no" then 1 else 0 end) as NO,
count(*) as TOTAL
from HAVE
group by ISSUE;
quit;
Thank you so much. It worked in Proc SQL. Is there any way I can do this in Proc Report or Proc Summary?..
It is best for proc tabulate.
data have;
input id Issue & $20. Fixed $;
cards;
1 Issue 1 yes
2 Issue 2 no
3 Issue 3 yes
4 Issue 1 yes
4 Issue 3 no
5 Issue 1 no
5 Issue 2 yes
5 Issue 3 no
;
run;
proc tabulate data=have;
class issue fixed;
table issue,fixed*n all;
keylabel n=' ';
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.