I guess you wanted this: proc sort data=Dates; by FileNo createdate; run; data Dates_1; set Dates; by FileNo; if last.FileNo; run; which will give you the latest createdate for any FileNo. If you take a look at the log of your first try, you will get a clue where your problem is: NOTE: Variable 'last.createdate'n is uninitialized. A first. and last. pseudovariable is created only for those columns named in a by statement.
... View more