This code will do the trick. Nice blog Dave, btw!
dt = New Table( "Year Example",
Add Rows( 3 ),
New Column( "ABC", Numeric, Continuous, Format( "Best", 12 ), Set Values( [1, 2, 3] ) ),
New Column( "DEF", Numeric, Continuous, Format( "Best", 12 ), Set Values( [4, 5, 6] ) ),
New Column( "Year 1", Numeric, Continuous, Format( "Best", 12 ), Set Values( [7, 8, 9] ) ),
New Column( "Year 2", Numeric, Continuous, Format( "Best", 12 ), Set Values( [10, 11, 12] ) ),
New Column( "Year 3", Numeric, Continuous, Format( "Best", 12 ), Set Values( [13, 14, 15] ) )
);
col_list = dt << get column names(string);
for (i = nitems(col_list), i > 0, i--,
if (!contains(col_list[i], "Year"),
remove from(col_list, i);
);
);
dt << Subset(
Output Table( "Year Subset" ),
All rows,
columns( eval(col_list) )
);