Here is my table. I want to get the result group by Tenure. Percentage=1-(No Change,N/(Sum-Not Found,N)) e.g. for NBUS Percentage=1-(250/(517-146)), for Season Percentage=1-(917/(2028-680)) Tenure Status_Change Status Count Sum NBUS Change N 95 517 NBUS No Change N 250 517 NBUS Not Found N 146 517 NBUS Change Y 0 517 NBUS No Change Y 23 517 NBUS Not Found Y 6 517 Season Change N 309 2028 Season No Change N 971 2028 Season Not Found N 680 2028 Season Change Y 2 2028 Season No Change Y 35 2028 Season Not Found Y 31 2028 Here is my code, it has ERROR: Subquery evaluated to more than one row. proc sql; create table table2 as select *, Sum(Count) as Sum from table1 group by Tenure; proc sql; create table table3 as select Count/(select (Sum-Count) as Dif from table2 where Status='N' and Status_Change='Not Found') from table2 where Status='N' and Status_Change='No Change'; Thanks a lot.
... View more