I just posted this and I think it applies here as well. In your case I would also recommend another step - at the end of your macro you may want to remove any temporary data sets so they're not around for another macro iteration.
Wrap your code in %macro/%mend and assign a name, eg:
%macro summarize;
*your sas code;
%mend;
Test that it works by calling it.
%summarize;
Change macro to use a parameter - the parameter is called dataset, and changes for each dataset you'd like to process
%macro summarize(dataset);
Change variable name in code to be parameter value, eg:
proc means data=&dataset;
...
run;
Test again
%summarize(bpchild);
Make sure it works for multiple cases.
... View more