BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello dears sas users
in france it's sad because we went back to home in football...

data allez_france;
format un $20.;
un="on est nuls";
output;
un="domenech demission";
output;
run;

if i want to create an counter of lines with a data step i can do
data count;
set allez_france;
i=_n_;
run;

i just want to know the equivalent code in proc sql please
thank you
4 REPLIES 4
deleted_user
Not applicable
You can get the row number using monotonic() function within proc sql.
Cynthia_sas
Diamond | Level 26
Hi:
For simple queries, monotonic() may work. However, see this Tech Support note:
http://support.sas.com/kb/15/138.html
which says:
"Using the MONOTONIC() function in PROC SQL can cause missing or non-sequential values to be returned."


You may want to check with Tech Support or switch to using PROC PRINT's obs numbers or use a DATA step program to create an obs number variable.

cynthia
deleted_user
Not applicable
Thank you, Cynthia.
deleted_user
Not applicable
Thank you cynthia and vasile

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1256 views
  • 0 likes
  • 2 in conversation