The same code works OK with the new supposition: if all values of PWPUMAS are the same then MAX(PWPUMAS) is this value for each IN_PUMA_ID You can also use the following code assuming both files are sorted by IN_PUMA_ID and PWPUMAS has the same value for each IN_PUMA_ID: Data new; merge Agearank (in=in_rank) Agea (keep=IN_PUMA_ID PWPUMAS); by IN_PUMA_ID; if in_rank; run; CTorres
... View more