Let d=(d1,d2,…,dn) be a vector of nonnegative integers. We study the number of symmetric 0–1 matrices whose row sum vector equals d. While previous work has focussed on the case of zero diagonal, we allow diagonal entries to equal 1. Specifically, for D∈{1,2} we define the set GD(d) of all n×n symmetric 0–1 matrices with row sums given by d, where each diagonal entry is multiplied by D when forming the row sum. We obtain asymptotically precise formulae for |GD(d)| in the sparse range (where, roughly, the maximum row sum is o(n1/2)), and in the dense range (where, roughly, the average row sum is proportional to n and the row sums do not vary greatly). The case D=1 corresponds to enumeration by the usual row sum of matrices. The case D=2 corresponds to enumeration by degree sequence of undirected graphs with loops but no repeated edges, due to the convention that a loop contributes 2 to the degree of its incident vertex. We also analyse the distribution of the trace of a random element of GD(d), and prove that it is well approximated by a binomial distribution in the dense range, and by a Poisson binomial distribution in the sparse range.