help for reorder

Reorder variables in dataset, reversibly

reorder varlist

reorder, previous


reorder varlist changes the order of the variables in the current dataset. The variables specified are moved, in order, to the front of the dataset. reorder used in this way resembles order, except that the varlist specified is saved in a characteristic.

reorder, previous changes the order of the variables in the current dataset to the order previously set with reorder. This applies not only in the current session, but also in subsequent sessions - so long as the dataset, including the characteristic, is saved using save, replace. Thus after some initial reorder successive applications of reorder, previous can be used to toggle back and forth between two orderings.


previous specifies that the order of variables should return to that previously specified by reorder with the same dataset.


. reorder price-foreign

. reorder, previous


Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk


This problem was suggested by Susan Hailpern. Kit Baum made helpful comments.

Also see

On-line: help for order Manual: [R] order