In reply to Satya Srinivas K.

Thank you, Satya, for sharing your implementation. However, I must correct you regarding “you used more steps than necessary to achieve the same result as mine”. It is quite the opposite as your macro uses 'n' data steps (generated by the macro loop) while macro %split() described in this post does all the splitting in a single data step. Some extra logic before that single processing data step is necessary in order to make this macro multi-functional: depending on SPLIT_DEF (=SETS or =NOBS) it can divide a dataset into SPLIT_NUM datasets or it can divide a dataset into several datasets of SPLIT_NUM observations each.