This paper examines the significance of physician agency in medical providers' prescription choices. Physician agency is considered as medical providers' responses to the price and markup percentage of prescription drugs. Their preferences are allowed to be heterogeneous using a random coefficient logit model. Using a sample of anti-diabetic prescriptions with metformin from a population-based database in Taiwan, empirical results reveal that physician owners, privately-owned medical providers, small medical providers and the medical providers facing less competition are more likely to prescribe drugs with higher profit margins. The aggregate pharmaceutical demand is also found to increase with the markup, which is allowed to be endogenous in the estimation. Price elasticity estimates suggest medical providers are quite responsive to pharmaceutical price changes in Taiwan. Counterfactual analysis reveals the potential impact of physician agency is economically significant. Removing markups and lowering pharmaceutical prices are found to be more welfare enhancing than restricting physicians' dispensing services.