Oh, try this! I had the same need I believe:
names default to here(1);
nw=newwindow("Select tables and column",show menu(0),
Hlistbox(
Panelbox("Data Table to select columns",
lb1=listbox(get data table list ())
),
Panelbox("data table to select rows",
vlistbox(
lb2=listbox(get data table list ()),
clb1=collistbox(),
button box("press to get columns", dtname2=lb2 << Get Selected; names = datatable(dtname2[1]) << Get Column names; clb1 << append (names);),
button box("press to select columns",col=clb1 << Get Selected; colist=column(datatable(dtname2[1]),col)<< GetValues(Format());
dtname1=lb1 << Get Selected;
colqty=datatable(dtname1[1])<<get column names("string");
for(i=1, i<= nitems(colqty),i++,
for(j=1, j<=n items(colist),j++,
print(colqty[i],colist[j]);
if(colqty[i]==colist[j],
column(datatable(dtname1[1]),colist[j])<< Set Selected( 1 );
j=1;
break();
);
);
);
)
)
)
)
);