While I think @Kurt_Bremser is mostly right when he states that splitting datasets is often a waste of time, sometimes you still have to. For instance if you are mailing or otherwise forwarding data to specific departments (or customers), and they are not supposed to get the data for the other departments.
A simple solution for creating multiple datasets goes something like this:
1. Create a solution that works for a single value of the parameter, e.g.
data want3007;
set have;
where IEE=3007;
run;
2. Make that into a macro, using the parameter:
%macro extract(IEE);
data want&IEE;
set have;
where IEE=&IEE;
run;
%mend;
3. Test the macro with a single, known parameter:
options mprint; /* lets you see the code generated in the log */
%extract(3007);
4. Use SQL to put all the macro calls into a single macro variable:
proc sql noprint;
select distinct cats('%extract(',IEE,')') into :doit separated by ';'
from have;
quit;
5. Execute that:
&doit;
... View more