Use the mod() function on the automatic variable _N_ in a subsetting if.
To get more information, do google searches on
SAS mod function
SAS _n_ variable
SAS subsetting if
To do this is easy. But to do it using a DO loop is not as easy, and not really a "beginner's" problem. For example:
data want;
do _n_=100 to _nobs_ by 100;
set have point=_n_ nobs=_nobs_;
output;
end;
stop;
run;
Accomplishing this without a DO loop is relatively easy and a more appropriate problem:
data want;
set have;
if mod(_n_, 100) = 0;
run;
Even so, most beginners would find this method challenging.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.