- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SQL has no concept of row order, and the order is never guaranteed.
Use a data step instead.
For SQL, this not-recommended code might help:
proc sql;
select monotonic() as M, mod(calculated M, 2) as ODD
from SASHELP.CLASS;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please try the below code with mod function to generate the odd and even row tables by proc sql
proc sql;
create table odd as SELECT * FROM (select *, monotonic() as row from sashelp.class ) where mod(row,2)<>0;
create table even as SELECT * FROM (select *, monotonic() as row from sashelp.class ) where mod(row,2)=0;
quit;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What does your input look like, or an example, and what should the output look like?
There can be more than one interpretation of your subject line.
It could be "is the record order value even/odd"
It could be the record number is even/odd (not always the same thing with deleted information)
Is the value of some variable, or combination of variables even/odd.
Is the explicit value of some variable (or variables) the text "even" or "odd".
And I suspect that if I spent some time I might come up with a few more. So something specific might be a good idea.