Date: Sat, 15 Feb 1997 23:33:21 GMT
Reply-To: Wayne Yu <wyu@GPU4.SRV.UALBERTA.CA>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Wayne Yu <wyu@GPU4.SRV.UALBERTA.CA>
Organization: University of Alberta
Subject: Last(Frist).var when two variables are used in the BY statement
Hello all,
I have sorted a file by City and Year and let's say it looks like
Denver 1990 13.5
Denver 1991 14.5
Denver 1992 14.8
LA 1979 9.8
LA 1980 10.9
LA 1981 -10.6
NY 1982 19.8
NY 1983 9.8
...
I want to pick out each city's last year's observation. So the resultant
sample will look like
Denver 1992 14.8
LA 1981 -10.6
...
I know one can use the temporary variable created by SAS 'last.variable'
to pick out the last observation for cases where there is only one sorting
variable. The question is how can I do this with two sorting variables?
Your help is greatly appreciated. Please send your help reply to
wyu@gpu.srv.ualberta.ca
Thanks in advance!
Wayne