i have the below code, which generate column O as 1 for 300 observations. But i want to get an output in such a form like o=1 for (1 to 6) obs and o=2 for (7 to 12) obs and so on o=50 for obs (295 to 300).
Could any one help me regarding the same. Thanks in advance!!.
data temp; do i=1 to 300 by 6; do j=i to i+5; o=1; output; end; end; run;
If O is the only variable you need in dataset TEMP, this is sufficient:
data temp;
do _n_=1 to 300;
o+(mod(_n_,6)=1);
output;
end;
run;
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!