I am calling mata in a stata do file. The following code sums over the columns in matrix A. Is there a way to only sum over negative entries?
mata : st_matrix("B", colsum(st_matrix("A")))
So:
A = [1 2; -2 -2; -3 -1]
B = [-5 -3]
mata : st_matrix("B", colsum(st_matrix("A")))
So:
A = [1 2; -2 -2; -3 -1]
B = [-5 -3]
Comment