Hello everyone, I have asked a similar question earlier How to create two tables with actual data and percentage displayed in the same table? Now, that the CCs are not in a range from 1- 177. It consists of a group of random number such as 1, 2, 3, 4, 6, 11, 13, ....., 254 I have come up with a table that flags what CCs each person has. data test1; set CC_test (keep=id %CC_LIST ) ; run; PROC SQL; CREATE VIEW test2 AS SELECT SRC.*, "StackedValues" AS _EG_IDCOL_ FROM test1 AS SRC; QUIT; It looks like: ID CC1 CC2 CC3 CC4 CC6 CC11 CC13 CC254 1 0 0 1 0 0 1 0 1 2 0 0 0 0 0 0 1 0 12 1 0 0 0 1 0 0 0 123 0 0 0 0 0 1 0 0 134 0 1 0 0 0 0 1 0 145 1 0 0 0 1 0 0 1 From this table, I can see that ID1 has CC3, CC11, CC254... Eventually I would like to count on how many IDs who have CC1 also have CC2 CC3... I want my table to look like CC CC1 CC2 CC6 CC13 1 200 (100%) 50 (25%) 15 30 2 50 (100%) 3 6 0 6 70 15 12 37 13 56 43 10 1 From this table, I would be able to see 200 people have CC1. From the CC1 population, 50 also have CC2..15 have CC6..etc. It is more like a matrix table with discontinuous numbers of CCs. Can anyone let me know how to do it?
... View more