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 Step | DATA step |
Featured Step Options and Statements | CALL SORTC and CALL SORTN CALL routines LARGEST, ORDINAL, and SMALLEST functions |
Related Technique | DATA 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 ...
Get Combining and Modifying SAS® Data Sets: Examples Second 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.