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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.