A Stata do file that contains code written to analyse longitudinal data on the quality of care delivered by family health teams participating in Brazil’s National Programme for Improving Primary Care Access and Quality (Programa Nacional de Melhoria do Acesso e da Qualidade da Atenção Básica [PMAQ]). The study analysed longitudinal data collected over three rounds of implementation: round 1 (Nov 2011 – Mar 2013), round 2 (Apr 2013 – Sep 2015) and round 3 (Oct 2015 – Dec 2019). The underlying PMAQ data are owned by the Ministry of Health in Brazil and we do not have permission to share the data publicly. However, we provide the codebook for the combined dataset.