Ahh, sorry. The error is that the PRINT statement in PROC IML (15.1) prints valid matrices. Apparently D is not a matrix for some value of j. You can use the LISTPRINT modules (or the STRUCT module) to print lists.
If the list contains some elements that are matrices and others that are lists, you can use the TYPE function to determine how to print the item:
proc iml;
package load ListUtil;
subs = [{A B C}, /* subs$1 is a vector */
{1 2, 3 4}, /* subs$2 is a matrix */
[4, 5:6]]; /* subs$3 is a list */
call ListPrint(subs); /* print the entire list */
/* or go through item by item and decide what to do */
do j = 1 to ListLen(subs);
d = ListGetItem(subs,j);
print j;
if type(d)='N' | type(d)='C' then
print d;
else if type(d)='L' then
call ListPrint(d);
end;
For more about lists and printing, see p 7-8 of Wicklin (2017), and also the question on p. 19.