Tips:SQL function MONOTONIC

From sasCommunity
Jump to: navigation, search

MONOTONIC() is the PROC SQL equivalent of coding a new variable from _N_ in a DATA step.

DATA class; 
     SET SAShelp.class;
     ord = _N_;		        /*creates a column containing row number called ord*/
RUN;

or

PROC SQL;
     CREATE TABLE class AS
     SELECT *, 
         MONOTONIC() AS ord	 /*creates a column containing row number called ord*/
     FROM SAShelp.class;
QUIT;
Submitted By Nina L. Werner (talk)