I've looked through several other related questions but haven't really found something that meets my case.
I have a column that dictates how many columns will be summed into a new column.
- If
DEPENDENCY == INDEP
thenNET_AGI = IND_AGI
- If
DEPENDENCY == DEP
thenNET_AGI = PRO_AGI + IND_AGI
- Otherwise
NET_AGI = PRO_AGI
DEPENDENCY IND_AGI PRO_AGI NET_AGI <- NET_AGI will be the summed column
INDEP 0049995 - 0049995
DEP 0000500 0090500 0091000
DEP 0009000 0121095 0130950
DEP - 0375001 0375001
INDEP 0123456 - 0123456
DEP 0012070 1023030 1035100
...
What's the best way to do that?