of the Month
Sometimes we want to add the observation number to a dataset. In the datastep we can easily do
data dataset; set dataset; obsn=_n_; run;
However, if you are using SQL, this is not so easy. There is an undocumented function called the MONOTONIC function that will help, as the following code shows:
proc sql; create table dataset as select monotonic() as N, * from dataset; quit; run;
Have a safe and happy May.
Updated May 17, 2013