In SAS, how do I reorder variables in a data set?
When you have existing data in SAS and want to change the order of the
variables, use the
retain statement. Suppose you have a
mydata with variables in the order of
a b d . To change the order to
a b c d
e , use the following code:
If you have questions about using statistical and mathematical software at Indiana University, email UITS Research Analytics (formerly known as the Stat/Math Center). Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200, and is open for consultation by appointment Monday-Friday 9am-5pm. For more, visit Research Analytics on the web, or call 812-855-4724 (IUB) or 317-278-4740 (IUPUI).
Last modified on November 13, 2012.