Some data sets contain observations corresponding to pairs of entities (people, companies, countries, etc.). Conceptually, each observation corresponds to a cell in a square matrix, where the rows and columns are labelled by the entities. For example, consider a square matrix where the rows and columns are the 50 U.S. states. Each observation would contain numbers such as the distance between the pair of states, exports from one state to the other, etc. The observations are not independent, so estimation procedures designed for independent observations will calculate incorrect standard errors. The quadratic assignment procedure (QAP), which is commonly used in social network analysis, is a resampling-based method, similar to the bootstrap, for calculating the correct standard errors. This talk explains the QAP algorithm and describes the -qap- command, with syntax similar to -bstrap- command, which implements the quadratic assignment procedure and allows running any estimation command using QAP samples.