As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Ordering Columns in a SAS® Dataset: Should you really RETAIN that?

From sasCommunity
Jump to: navigation, search
Andrew Clapson
Statistics Canada


When viewing and working with SAS® data sets - especially wide ones - it's often instinctive to rearrange the variables (columns) into some intuitive order. The RETAIN statement is one of the most commonly cited methods used for ordering variables. Though RETAIN can perform this task, its use as an ordering clause can cause a host of easily missed problems due to its intended function of retaining values across DATA step iterations. This risk is especially great for the more novice SAS programmer. Instead, two equally effective and less risky ways to order data set variables are recommended, namely, the FORMAT and SQL SELECT statement

Online resources

You can download the .pdf of the paper from here.

See also