just wanted to share the "out of the box" moment.
&SYSINDEX is clearly documented "You can use SYSINDEX in a program that uses macros when you need a unique number that changes after each macro invocation."
I wanted a unique number when some conditions occurred in a macro and thought of &SYSINDEX. but it only created a constant :-( .
This time the light bulb switched on and I saw out of the box ;-) I should use %SYSINDEX .
OK, I know that does not exist, but it is simple enough to create[pre] %macro sysindex ;
%mend sysindex ;[/pre]So I only needed to change that "&" prefix into "%" before the SYSINDEX and obtained exactly what I needed.
Every invocation of %sysindex provides a unique number for the SAS session. :-)
The monotonic() function is undocumented (which is why you can't find it!). This is because it can be problematic and produce unexpected results in some cases, e.g. when used within PROC SQL. So if you go that route, be careful!