Display 9.4Expanding a single record into multiple records
data D6;
input name $ sex $ t1 t2 t3 t4 t5 time6 time_7;
ARRAY num_array{*} _NUMERIC_;
DO inum = 1 to dim(num_array);
time = inum;
ADL = num_array{inum};
output;
END;
keep name sex time ADL;
datalines;
Smith M 6 6 5 5 5 4 3
Jones F 7 5 4 4 3 2 1
Fisher M 5 5 5 3 2 2 1
;
run;
The arraystatement collects all of the numeric variables. The dimfunction returns the
length of this array (=7in this example). The timevariable is defined in the loop, and
the ADLvariable is defined in terms of each array element.Theresultsof this iterative ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.