Hey @SASdevAnneMarie! I've got some old code that does this:
%macro split_data(data=, splits=);
%let dsid = %sysfunc(open(&data));
%let n = %sysfunc(attrn(&dsid, nlobs));
%let rc = %sysfunc(close(&dsid));
%put Total obs: &n;
%put -------------------------------;
%do s = 1 %to &splits;
%let firstobs = %sysevalf(&n-(&n/&splits)*(&splits-&s+1)+1, floor);
%let obs = %sysevalf(&n-(&n/&splits)*(&splits-&s), floor);
%put split: &s;
%put firstobs: &firstobs;
%put obs: &obs;
%put total: %eval(&obs-&firstobs+1);
%put -------------------------------;
%end;
%mend;
For example:
%split_data(data=sashelp.cars, splits=3);
Total obs: 428
-------------------------------
split: 1
firstobs: 1
obs: 142
total: 142
-------------------------------
split: 2
firstobs: 143
obs: 285
total: 143
-------------------------------
split: 3
firstobs: 286
obs: 428
total: 143
-------------------------------
You can modify this to save each split point to a macro variable. There are probably a dozen other ways to do this, but this is one that I've had for many years to help me find split points. I mostly used it for splitting data up to work in parallel RSUBMIT sessions, but occasionally have used it to send data to people as chunked up CSV files since they requested it that way.
... View more