Monday, October 30, 2006

The Monotonic Function

There is an undocumented function that enables you to generate observation numbers with a PROC SQL statement and retain them in an output data set.

You can use the NUMBER option in a PROC SQL statement to print observation numbers, but the observation numbers are not retained (just like PROC PRINT w/o the nobs option).

To keep the observation numbers in the output table, use the MONOTONIC function in the SELECT statement.

Example:

Proc sql;
create table step1 as
select monotonic() as ID,
district, district_name
from perm.districts;
quit;

To do the same thing in a data step:
ID = _n_;

27 Comments:

At 2:02 PM, Anonymous Anonymous said...

The Monotonic Function is undocumented for SAS's version of SQL for a reason it can cause some unexpected results. This is documented by SAS.

 
At 5:15 AM, Anonymous Anonymous said...

So...what are the unexpected results? If you can elaborate please because I can't find anything on this @ SAS. This is the next best thing in proc sql if you do not want to do a data step.

 
At 9:57 PM, Blogger Easy said...

I've found the results to not be in order - monotonic() = 1 appears on the 5th observation.

 
At 12:26 AM, Blogger Saumil said...

How to apply monotonic to each group in a table??

example:

Student Subjects Count
ABC P 1
ABC Q 2
ABC R 3
ABC S 4
PQR T 1
PQR Y 2
PQR R 3
PQR Q 4

 
At 2:13 AM, Blogger Priya Tamil said...

It's really interesting articles, more people are would do it those type of information.,,I like that kind of valuable post.
ccna training

 
At 1:59 AM, Blogger Priscilla said...

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate your confidence and trust in us..SAP Training in chennai

 
At 5:15 AM, Blogger Priscilla said...

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate your confidence and trust in us..SAP Training in chennai

 
At 3:14 AM, Blogger Camellia Canan said...


All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.


SAP training in Chennai

 
At 12:37 AM, Blogger Camellia Canan said...



These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post. Your articles really impressed for me,because of all information so nice.

SAP training in Chennai

 
At 2:13 AM, Anonymous keerthi said...


Great post!! This can be one particular of the most useful blogs We’ve ever arrive across on this subject. Basically Wonderful. I am also a specialist in this topic so I can understand your hard work.

Corporate Training in Chennai

 
At 2:36 AM, Blogger Aasha said...

Really i enjoyed very much. And this may helpful for lot of peoples. So you are provided such a nice and great article within this.

Digital Marketing For Small Business in Chennai

 
At 2:30 AM, Blogger Abiya Carol said...

It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command .

Branding Services in Chennai

 
At 2:30 AM, Anonymous sindhu said...

A nice article here, i think that people who have grown up with the idea of using computers are showing more responsibility towards writing posts that are thoughtful, do not have grammar mistakes and pertinent to the post..

CRO Agency in Chennai

 
At 3:14 AM, Blogger Sathya G said...

the blog is very interesting and will be much useful for us. thank you for sharing the blog with us. please keep on updating.
ROI Services in Chennai

 
At 12:11 AM, Blogger Harish Raju said...

This blog is having a wonderful talk. The technology are discussed and provide a great knowledge toall. This helps to learn more details about technology. All this details are important for this technology. Thank you for this blog.
Digital Marketing Company

 
At 5:51 AM, Blogger Saki R said...

nice blog too informative. looking and reading your points its so impressive. doing more blog like this. i really appreciated doing like this.
Java Training in Chennai

 
At 11:38 PM, Blogger Sathya G said...

Thank you for taking the time to discuss this informative content with us. I feel happy about the topic that you have shared with us. keep sharing your information regularly for my future reference. This content creates a new hope and inspiration with me. Thanks for sharing article. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.
Hadoop Training in chennai

 
At 12:20 AM, Blogger Geethapriya said...

Great information shared in this blog. Helps in gaining concepts about new information and concepts.Awsome information provided.Very useful for the beginners.
SEO Training in Chennai

 
At 11:30 PM, Blogger Karthi Swetha said...


These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post.our giving articles really impressed for me,because of all information so nice.


Java J2ee training in chennai

 
At 2:08 AM, Blogger Evangeline Mitul said...

Your thinking toward the respective issue is awesome also the idea behind the blog is very interesting which would bring a new evolution in respective field. Thanks for sharing.

Best Dental Clinic In Vellore

 
At 9:49 PM, Blogger sathya said...

I read this content really awesome.You provided another one great article.I hope this information may change my business carrier.I can remember these things whenever taking the decision.

MSBI Training in Chennai

Informatica Training in Chennai

 
At 11:04 PM, Blogger John Alert said...

Very informative article. I liked it.
corporate training in chennai corporate training in chennai corporate training companies in india corporate training companies in india corporate training companies in chennai corporate training companies in chennai Angular 2 Corporate Training Angular 2 Corporate Training

 
At 2:51 AM, Anonymous Mahalyasree said...

It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
Best Interior Designers in Chennai
Interior Designers in Chennai

 
At 5:16 AM, Blogger Sowmiya said...

Really Good blog post.provided a helpful information.I hope that you will post more updates like this.
MSBI Training in Chennai

 
At 5:16 AM, Blogger Sowmiya said...

Really Good blog post.provided a helpful information.I hope that you will post more updates like this.
MSBI Training in Chennai

 
At 1:10 AM, Blogger sandhosh said...


Thank you for this great article which is about Monotonic Functions .keep more updates.
SEO Company in India

 
At 3:55 AM, Blogger Karthi Keyan said...


very very amazing explaintion....many things gather about yourself...yes realy i enjoy it

Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
Digital Marketing Company in India

Digital Marketing Services in India

Digital Marketing Agency in India

 

Post a Comment

<< Home