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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1468 views
  • 0 likes
  • 2 in conversation