O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 9.6 Sorting Variable Values within an Observation

Goal

Sort a series of character variable values and a series of numeric variable values within an observation.

Example Features

Featured StepDATA step
Featured Step Options and StatementsCALL SORTC and CALL SORTN CALL routines LARGEST, ORDINAL, and SMALLEST functions
Related TechniqueDATA step and ORDINAL function: ORDINAL sort in descending order

Input Data Set

Data set ADSURVEY contains responses from five partipants in a survey for a store. The three character variables NOTICED1, NOTICED2, and NOTICED3 list where the respondent saw an ad. The three numeric variables AMOUNT1, AMOUNT2, and AMOUNT3 are the amounts spent (if positive) or refunded (if negative) as recalled by the respondent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required