Wireless sensor networks is a kind of self-organizing networks which consist of large numbers of low-cost and low-power tiny sensor nodes that can communicate with each other to perform sensing, processing and storing sensed data cooperatively. In order to effectively reduce the amount of data transmission to cut down the overall energy consumption based on the strict energy limitations in wireless sensor networks, and simultaneously guarantee the security of sensed data aggregation, a secure data aggregation algorithm based on set pair analysis of sensor node reputations is presented. The employment of subtractive clustering method based on density function during the node clustering phase results in faster clustering speed, more reasonable cluster head distribution, and more preferable cluster size. In the phase of data transmission, the selection of next hop node is modeled as a multiple attribute decision making process. The networks data stream therefore obtains equilibrium and safety by virtue of the comprehensive evaluation of the multifold cluster head attributes (reputations, energy, etc) and the obtainment of optimal cluster head for relaying the aggregated data. Simulation results show that the proposed algorithm is superior to similar data aggregation algorithms such as LEACH algorithm and BTSR algorithm in aggregation precision, aggregation security, and cluster head energy consumption.