SAS Monotonic (would you like Gin and a slice of Lemon with that)

I was using Enterprise Guide the other day to merge some data into a single table and I needed to generate a unique sequence for a derived column.

I asked around for the best option and was told that using ‘_n_’in a datastep would do i, but of course this would have to be a custom code node, and I was using the Enterprise Guide filter and query wizard, which meant I would have to create a second step within my process flow.

No biggy, but within Oracle I would have just called the Sequence function and all would have been good,

Then our resident SAS Geek (note the removal of Uber) mentioned that I could use ‘Monotonic()’. So I created a new computed column in the query, added Monotonic() as the expression and Bob’s you uncle (or even Aunt these days) EG produced a unique sequence in the new column.

The Monotonic() function is apparently experimental in SAS 9.1. But was mentioned in a SUGI paper : Helpful Undocumented Features in SAS

And according to Wikipedia it is:

“In mathematics, a monotonic function (or monotone function) is a function which preserves the given order.”

  • Share/Bookmark

SAS Functions

SAS functions enable you to add powerful logic to your SAS code.

According to the SAS Online Documentation, SAS functions are defined as:

“A SAS function performs a computation or system manipulation on arguments and returns a value. Most functions use arguments supplied by the user, but a few obtain their arguments from the operating environment.”

You can see details on what SAS functions are and how they can be used at SAS Functions and Call Routines overview online documentation page.

You can also see a complete list of the functions available at the SAS Functions and Call Routines Dictionary online documentation page.

  • Share/Bookmark