I have totalled a column of numbers
ID amt difference
11 -250 125
11 125 125 /*only want to show this number*/
12 -250 -250
proc sql;
create table test as
select id, sum(
case when reg_num = 'w' then amt
when reg_num = 'y' then amt
else 0 end)as difference
from main
group by ln_no;
quit;
In the case of ID 11, I want to show the 125 difference in the second instance of the same ID. So I want to show ID on row 2 and leave row 1 blank. In the case of ID 12 I want to show the difference because it is the first and only instance.