|
Here AGE in SASHELP.CLSSS equal PERSON.
When last is also first what do you want to do? I used last.
proc sort data=sashelp.class out=class;
by age;
run;
proc print;
run;
data next2Last;
_n_ = 0;
do until(eof);
do _n_ = _n_+1 by 1 until(last.age);
set class(keep=age) end=eof;
by age;
end;
point = _n_-(last.age*not first.age);
obs = point;
set class point=point;
output;
call missing(of _all_);
end;
stop;
run;
proc print;
run;
On 2/23/12, Alison <alisontetler@yahoo.com> wrote:
> Hi - I think this should be an easy task but can't quite get it. I have
> multiple observations per person (series of births) and want to select the
> next to last observation in the dataset per person. How do I do this??
> Thanks!
> Alison
>
|