Summary Causal inference in a programme evaluation setting faces the problem of external validity when the treatment effect in the target population is different from the treatment effect identified from the population of which the sample is representative. This paper focuses on a situation where such discrepancy arises by a stratified sampling design based on the individual treatment status and other characteristics. In such settings, the design probability is known from the sampling design but the target population depends on the underlying population share vector, which is often unknown, and, except for special cases, the treatment effect parameters are not identified. In this paper we propose a method of constructing confidence sets that are valid for a given range of population shares. When a benchmark population share vector and a corresponding estimator of a treatment effect parameter are given, we develop a method to discover the scope of external validity with familywise error rate control. Finally, we derive an optimal sampling design that minimizes the semiparametric efficiency bound given a population share associated with a target population. We provide Monte Carlo simulation results and an empirical application to demonstrate the usefulness of our proposals.