- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 10-09-2019 04:45 AM
(1383 views)
I know nobs can be used but just wondering if there also exists a start option since there is an "end" one.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In a data step, a variable _N_ is automatically created and contains the currently processed row number. So you can just test :
if _N_=1 then ...
In a data step, a variable _N_ is automatically created and contains the currently processed row number. So you can just test :
if _N_=1 then ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Actually, _N_ contains the number of the current data step iteration. In most cases, since you only execute a set or merge statement once per iteration, this will correspond to the row number, but if you execute these statements more than once, you will get another result.
Compare this:
data test1;
set sashelp.class;
count = _N_;
run;
with this:
data test2;
do until (end_of_file);
set sashelp.class end=end_of_file;
count = _N_;
output;
end;
run;