Output 4.2 Character Variable Alignment in SAS HTML Output
Reordering Variables in SAS Output
You can control the order in which variables are displayed in SAS output by using the
following declarative statements:
ARRAY
ATTRIB
FORMAT
INFORMAT
LENGTH
RETAIN
For any of these statements to work, they must be placed prior to any one of the
following declarative statements:
SET
MERGE
UPDATE
Only the variables whose positions are relevant need to be listed. Variables not listed in
these statements retain their original position. For example, if data set Sashelp.Class has
variables Name, Sex, Age, Height, and Weight (in that order), then you can move the
variable Height to the first position by specifying the LENGTH statement as shown in
the following example:
Example Code 4.1 Using the LENGTH Statement to Reorder Variables
data Class1;
length Height 3; /* The LENGTH statement precedes the SET statement */
set Sashelp.Class; /* and causes the variable Height to be placed first */
run; /* in the output */
proc print data=Class1;
run;
Reordering Variables in SAS Output 47

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.