I have a matrix that is 12 rows by 500 columns. I would like to take the average and standard deviation of the rows. I have devised a method to take the mean but I have limited understanding of how to take the sd. For example,

Code:
clear all
clear mata

global num_rows = 3

matrix A = (1,2,9\2,7,5\2,4,18)
matrix B = J($num_rows, 1, 1)
matrix sum = A*B
matrix M = sum/$num_rows
mat all = A,M
How can I add the standard deviation of each row?

Thank you very much for your help.