Alternative to _N_ in PROC SQL

In PROC SQL, we can use MONOTONIC() function to generate row numbers. It is an alternative to _N_ in data step.

SAS Code : To select row numbers between 10 and 20
proc sql noprint;
create table temp as
select  *
from sashelp.class
where monotonic() between 10 and 20;
SAS Code : To generate row numbers
proc sql noprint;
create table class2 as
select  monotonic() as Number, *
from sashelp.class;

Best Online Course : Practical SQL Guide for Beginners

Proc SQL Tutorials : 15 Proc SQL Tutorials

SAS Tutorials : 100 Free SAS Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Alternative to _N_ in PROC SQL"

Post a Comment

Next → ← Prev