On the contrary, working across observations is complicated.
In this post we will put the basics of two statements that allow to communicate information across registers.
- RETAIN
data better;
retain subject 0;
subject = subject + 1;
input score 1 score 2;
datalines;
run;
RETAIN presents some problems, specially when dealing with missing values. If a value is missing, RETAIN does not maintain the previous non-missing value.
- LAG
if subj ne lag(subj) then old = new;
Here, old only changes when there is a new subject.
No comments:
Post a Comment