LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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

Thanks in advance!


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