ARCHIVED: 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:
data mydata; retain a b c d e; set mydata; run;
If you have questions about using statistical and mathematical software at Indiana University, contact Research Analytics. Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200; staff are available for consultation Monday-Friday 9am-noon and by appointment.
This is document baud in the Knowledge Base.
Last modified on 2015-06-30 00:00:00.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.