Beginning with SAS® 9.2, you can programmatically determine which ODS destinations are open by querying the Dictionary.Destinations dictionary table. Querying the Dictionary.Destinations table displays both the open ODS destinations and the style that is applied to each destination. As with other dictionary tables, you can also determine this information with the Sashelp view Sashelp.Vdest.
See the Full Code section for sample code.
The sample code below lists to the log the current open ODS destination(s).
proc sql noprint;
select distinct destination into : dest
separated by ',' from dictionary.destinations;
quit;
%put &dest;