The prescription refill records of centralized pharmacies are a potential source of information about patient compliance with long-term medications. We developed a method for assessing compliance in such settings and validated our measures using pharmacy data and clinical information from patients with seizure disorders and hypertension. For patients taking the anticonvulsant medication phenytoin, compliance with the drug correlated significantly with mean plasma phenytoin level. For patients on antihypertensive medications, compliance with the treatment regimen correlated with control of diastolic blood pressure. Many patients (15% in the phenytoin validation, and 33% in the blood pressure validation) obtained substantial oversupplies of medications; for these patients, the direct relationship between compliance and drug effect was not evident. A majority of seizure patients with "subtherapeutic" mean plasma phenytoin levels were identified as noncompliant using our measures. We conclude that our method of assessing compliance in obtaining medications is feasible in "managed care" settings, appears to be a valid correlate of drug effects, and may be useful in research and patient care.