Hi Ksharp, Thank you for code, however i am not getting correctly when i have multiple PARAMCD and AVISITN. In sample data i have only kept the one PARAMD='EG" and one AVISITN = 7 , but i have other PARAMCD's total 3 and AVISITN have more values for each subject . So aim is for each set of USUBJID,PARAMCD,AVISIT have only one set REPNUM flag, as mentioned for each USUBJID,PARAMCD, AVISITN Above code is getting First REPNUM =1 records , but i need REPNUM = 1,2,3 records for each USUBJID,PARAMCD,AVISITN, which REPNUM set minimum ADY reccords and if same ADY in TWO sets of REPNUM then Last set REPNUM need. Thank you, Raja Some time REPNUM is only less 2 records. Thank you, Raja.
... View more