Alternative to _N_ in PROC SQL

Live Online Training : SAS Programming with 50+ Case Studies

- Explain Programming Concepts in Simple English
- Live Projects
- Scenario Based Questions
- Job Placement Assistance
- Get 10% off till Sept 25, 2017
- Batch starts from October 8, 2017

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;

Proc SQL Tutorials : 15 Proc SQL Tutorials

SAS Tutorials : 100 Free SAS Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.

While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

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