Is there any way to obtain a list of templates that exist in all template stores (such as what is provided with the LIST statement in PROC TEMPLATE), and save it to an output dataset, or capture it in a macro variable so the information could be used later in the program? So far, I could only find the LIST statement, but that only produces a listing in the output window.
The LIST statement does create an output object. You can see the name of the output object in the SAS log (because of the ODS TRACE ON/ODS TRACE OFF). This code should create a data set for you, named WORK.TEMPLIST.