I my be misunderstanding your need, but if you need all the rows to remain and just retain the value of the last pm value then you will have to do something like: proc sort data=dir.sampler; by date id descending time ; /*places last time row first in the dataset*/ run; data test; set dir.sampler; by date id descending time; if first,id then lastpm = pm; retain lastpm; /*keeps the value until changes at the next id*/ run; I dont have anything to test this with so this is untested code. Eric
... View more