If I substitute &effects with the actual text 'values("value1","value2","value3","value4","value5") values("value6","value7","value8","value9","value10")', no error is thrown. However, this is not a feasible solution, since the program should run automatically on several iterations.

Next comes the question if there is any necessity at all to temporarily store data in macro variables. The macro preprocessor is not built for handling data, but for creating dynamic program text, which makes keeping data in macro variables such tedious work.

Re: PROC SQL - INSERT INTO via MACRO VARIABLE - ERR 22:322

There are things in macro variables and macro calls/functions that are not visible for the programmer, but are used by the macro processor; especially when using the masking functions %str, %quote and so on.

Re: PROC SQL - INSERT INTO via MACRO VARIABLE - ERR 22:322

"The values are generated dinamycally after every iteration - that's why I am using a macro.

As far as I know, macro variables cannot be used into DATALINES statement."

Post example test data (in the form of a datastep) and what you want out, of what your exact problem is. It is very hard to say from minmal information, but what I can tell you is that this is not really the function of Macro language (i.e. creating data like this). The simplest answer is to take the code generating the randomm data, and instead of creating macro lists, write out to a plain CSV file, then read that in with a datastep import.