LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 23 Feb 2012 13:41:11 -0600
Reply-To:   "Data _null_;" <iebupdte@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Data _null_;" <iebupdte@GMAIL.COM>
Subject:   Re: outputting the next to last observation per group
Comments:   To: Alison <alisontetler@yahoo.com>
In-Reply-To:   <201202231850.q1NF3Wwm025343@waikiki.cc.uga.edu>
Content-Type:   text/plain; charset=ISO-8859-1

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 >


Back to: Top of message | Previous page | Main SAS-L page