Example 9.7 Shifting Nonmissing Values Left in an Observation

Goal

Shift to the left the nonmissing values in a list of values that are stored in an array.

Example Features

Featured StepDATA step
Featured Step Options and StatementsArray processing MAX, N, WHICHN functions
Related TechniqueDATA step: Array processing, MAX, N, WHICHN functions

Input Data Set

Data set TEST_MONTHS contains the admission test scores for five applicants over a six-month period.

                          TEST_MONTHS

Obs   applicant   sept09   oct09   nov09   jan10   feb10   mar10
 1     BN0Q6B       387       .       .       .     381       .
 2     ENAD1C       297     327       .     354       .       .
 3     EM5OBF       252       .     301       .       .     276
 4     HVPGZH         .       .       .       .       .     398
 5     2V1E4D       365       .       .       .       .       .

Resulting Data Set

Output 9.7 ADMISSION_TESTS Data Set

 Example 9.7 ADMISSION_TESTS Obs applicant ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.