Hi @pauldeen,
There are two approaches I found to tackle this problem.
The first approach is the simplier of the two, but requires putting the By variable value as a column in your summary statistics tables. In the example below, see the additional "Sex" column, which is initially collapsed but is uncollapsed temporarily to make the combined data table. See comments for details.
TestWindow = new window("Test with multiple tables",main = v list box());
main << Append(
Outline Box( "Distributions sex=F",
Outline Box( "height",
Outline Box( "Summary Statistics",
Table Box(
String Col Box( "Sex", Repeat( {"F"}, 10 ), <<Visibility( "Collapse" ) ),
String Col Box("",
{"Mean", "Std Dev", "Std Err Mean", "Upper 95% Mean", "Lower 95% Mean", "N", "Sum", "Variance", "CV", "N Missing"}
),
Number Col Box("",
{60.8888888888889, 3.61189031311679, 0.851330711102296, 62.6850396850604, 59.0927380927173, 18, 1096, 13.0457516339869,
5.93193664562977, 0}
)
)
)
)
)
);
main << Append(
Outline Box( "Distributions sex=M",
Outline Box( "height",
Outline Box( "Summary Statistics",
Table Box(
String Col Box( "Sex", Repeat( {"M"}, 10 ), <<Visibility("Collapse") ),
String Col Box("",
{"Mean", "Std Dev", "Std Err Mean", "Upper 95% Mean", "Lower 95% Mean", "N", "Sum", "Variance", "CV", "N Missing"}
),
Number Col Box("",
{63.9090909090909, 4.3084533840777, 0.918565347870119, 65.8193521238087,
61.9988296943731, 22, 1406, 18.5627705627705, 6.7415344558826, 0}
)
)
)
)
)
);
// Get a list of all of all invisible columns
collapsedCols = TestWindow <<Xpath( "//StringColBox[@isVisible='false']" );
// turn on the visibility of these columns
collapsedCols << visibility( "visible" );
// make a combined data table from the tables
TestWindow[TableBox(1)] << Make Combined Data Table();
// set the columns back to collapsed
collapsedCols << visibility( "Collapse" );
Here is the resulting table using this method:
The second method is to grab the By value information from the OutlineBox and concatenate the tables together. This method does not require any changes to the setup to your existing OutlineBox/Sumary Statistics setup, but is a little more complicated. See comments below for details.
TestWindow = new window("Test with multiple tables",main = v list box());
main << Append(
Outline Box( "Distributions sex=F",
Outline Box( "height",
Outline Box( "Summary Statistics",
Table Box(
String Col Box("",
{"Mean", "Std Dev", "Std Err Mean", "Upper 95% Mean", "Lower 95% Mean", "N", "Sum", "Variance", "CV", "N Missing"}
),
Number Col Box("",
{60.8888888888889, 3.61189031311679, 0.851330711102296, 62.6850396850604, 59.0927380927173, 18, 1096, 13.0457516339869,
5.93193664562977, 0}
)
)
)
)
)
);
main << Append(
Outline Box( "Distributions sex=M",
Outline Box( "height",
Outline Box( "Summary Statistics",
Table Box(
String Col Box("",
{"Mean", "Std Dev", "Std Err Mean", "Upper 95% Mean", "Lower 95% Mean", "N", "Sum", "Variance", "CV", "N Missing"}
),
Number Col Box("",
{63.9090909090909, 4.3084533840777, 0.918565347870119, 65.8193521238087,
61.9988296943731, 22, 1406, 18.5627705627705, 6.7415344558826, 0}
)
)
)
)
)
);
// get all of the tableboxes within a 'Summary Statistics' OutlineBox
tableBoxes = TestWindow << Xpath("//OutlineBox[text()='Summary Statistics']/TableBox");
//Create and insert each data table
dts = {};
For( i = 1, i <= N Items( tableBoxes ), i++,
tempDt = tableBoxes[i] << make into data table( "invisible" );
//set the name of the table to the title of the top outlinebox
tempDt << Set Name( (((tableBoxes[i] << Parent) << parent) << parent) << get title );
Insert Into( dts, tempDt );
);
// Concatenate the tables together, with a source column
dts[1] << Concatenate( Remove( dts, 1 ), Create source column );
// close all of the temporary tables
For( i = 1, i <= N Items( dts ), i++,
Close( dts[i] )
);
Here is the resulting table:
Justin