Let us share with you a very useful methodology for PROC SQL using in creating macro!

Try to appreciate the elegance of the design of the following code:

INTO : selds SEPARATED BY '); %create_set('
FROM s_info_d
WHERE dset NE 'DM';

This is how you get the list of observations of the saved variable in a macro list separated by the phrase ); %create_set(.

The “create_set” here is the name of the macro and the code like %create_set(&selds) will be automatically resolved as follows:

%create_set(ae); %create_set(ds); %create_set(eg); %create_set(ex); %create_set(lb); %create_set(mh); %create_set(pe); %create_set(qs); ...
and up to 9.2 quintillion observations possible to be taken from s_info_d dataset.

The language of the SAS macro simplifies the workflow. Writing macro functions to shorten a code and to obtain the analysis is a time saver. However, if there are hundreds of variables to plug in a macro function or if the same macro function is repeated by changing one of its arguments, then it is a time consuming process. And this process can be accelerated by such a special way.

On writing this post we were inspired by one of Papers on PharmaSUG conference 2022: https://lnkd.in/dhj7n6SD
Where Chary Akmyradov, Ph.D. shows how to use this technique to create the self-modifying macro to automatically repeat a SAS macro function.