BTW: You do realize that function monotonic() is really useful but also not documented and though not supported - which means not production worthy.
Which begs a question(s) I've had for some time...
1) How do I create an incrementing row number in PROC SQL production code?
2) Monotonic() is undocumented, has been undocumented for a lotof years, most folks in the SAS community know about it even though undocumented, and probably many folks are using it in production code.
3) Clearly there is a need for this functionality. SQL Server, Oracle, Postgres, and MySQL (the only ones I checked) all have the ROW_NUMBER() windowing function for this functionality. So how about SAS R&D renames monotonic() to row_number() (or better yet alias monotonic() to row_number() or vice versa, so existing "production" code doesn't break), run it through QA, and officially support this needed functionality?
4) ROW_NUMBER() in the above databases is more flexible than monotonic() since it operates over the windowing (grouping) columns (analogous to first. processing in the data step). It would be nice if the final production solution also supported such functionality.