One option is to assign a SAS numeric variable and after sorting your file with PROC SORT and using a specific BY variable list, use a DATA step to assign the numeric sequence variable. You will need to look at using a BY statement in the DATA step and using IF FIRST. to reset your sequence variable as needed.
Suggest you search the SAS support http://support.sas.com/ website for DOC and supplemental technical reference and conference papers on the topic -- here is a Google advanced search argument to consider using:
first last by group processing site:sas.com
Scott Barry
SBBWorks, Inc.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Registration is open
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and lock in 2025 pricing—just $495!