Two experiments studied the conditions of stimulus control necessary for the generalization of relational matching to sample. Matching required the selection of comparison shapes rotated 90º clockwise from the orientation of the corresponding sample. In Experiment 1, five children were taught to (a) code the orientations of samples, (b) transform the sample codings to account for the 90º rotation and (c) repeat the transformed coding response to a comparison. High levels of generalization occurred with a set of novel stimuli for which stable sample codings were initially available, In another novel set, where stable sample codings were not initially available, low levels of generalized matching were recorded. Matching performance improved after stable sample codings were trained. In Experiment 2, two children and three adults were trained in a form of the matching task that produced poor generalization despite the presence of stable sample coding responses. Retraining to modify the stimulus control exerted by these coding responses produced an immediate improvement in generalized matching to sample. Results suggest that the generalization of matching is dependent on the structure of stimulus control the component responses exert on each other.