[an error occurred while processing this directive]
An example is the merge algorithm. Merging always proceeds in the same way. You are given two datasets and the by-variables, you sort them by the by-variables and then merge them. I wrote up a ``standard merge'' macro named %stdmerge:
%macro stdmerge(inds1, inds2, byvar, outds); proc sort data=&inds1 nothreads; by &byvar; run; proc sort data=&inds2 nothreads; by &byvar; run; data &outds; merge &inds1(in=a) &inds2(in=b); by &byvar; if a and b; run; %mend;
In the SAS programs I write, when I want to merge two datasets, all I need to do is say
%stdmerge(firstdataset, seconddataset, by-variable-list, outputdataset)
instead of laboriously typing out the whole thing every time. This clears up an enormous amount of clutter from my SAS programs, making them much more readable.