The U.S. Department of Health and Human Services (HHS) (a federal or government agency) uses a variety of ways to collect and analyze health care data. There is a special group within HHS called the Agency for Healthcare Research and Quality (AHRQ) that does this job. One of their specific projects is to look at cost and use of health care services.
They use national statistics collected at the state and local level. There are even on-line systems designed to help doctors, hospitals, and clinics report information about patients, care, and costs. Patient information is private so no names or identifying information are ever included.
One of the largest databases on all patients in the U.S. is collected by the AHRQ. It’s called the Healthcare Cost and Utilization Project or HCUP. Information is collected regardless of insurance type, including patients who aren’t insured at all.