Help using Base SAS procedures

counter in proc sql;

Reply
N/A
Posts: 0

counter in proc sql;

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
N/A
Posts: 0

Re: counter in proc sql;

Posted in reply to deleted_user
You can get the row number using monotonic() function within proc sql.
SAS Super FREQ
Posts: 8,866

Re: counter in proc sql;

Posted in reply to deleted_user
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
N/A
Posts: 0

Re: counter in proc sql;

Posted in reply to Cynthia_sas
Thank you, Cynthia.
N/A
Posts: 0

Re: counter in proc sql;

Posted in reply to deleted_user
Thank you cynthia and vasile
Ask a Question
Discussion stats
  • 4 replies
  • 136 views
  • 0 likes
  • 2 in conversation