Action menus may contain cascading submenus.
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "Samples/business.sas7bdat" );
declare ScatterPlot plot;
plot = ScatterPlot.Create( dobj, "Sales", "Profits" );
plot.SetMarkerSize( 5 );
plot.SetObsLabelVar( "Company" );
plot.AppendActionMenuItem( "Color Code\nBy &Nation"J,
"run BusinessColorCode( plot, 'Nation' );" );
plot.AppendActionMenuItem( "Color Code\nBy &Industry"J,
"run BusinessColorCode( plot, 'Industry' );" );
/* Define module to color code business data set by
Nation or Industry and display legend on plot */
start BusinessColorCode( Plot plot, variable );
if variable='Nation' then do;
colors = RED||GREEN||YELLOW||WHITE||BLUE;
labels = {"Britain", "France", "Germany", "Japan", "USA"};
end;
else if variable = 'Industry' then do;
colors = RED||YELLOW||GREEN||BLACK;
labels = {"Automobiles", "Electronics", "Food", "Oil"};
end;
run ColorCode( plot.GetDataObject(),
variable, IntToRGB(colors), ncol(colors) );
plot.DrawRemoveCommands();
run DrawLegend( plot, labels, 8, colors, 0, -1, -1, 'IRB' );
plot.BulletActionMenuItem( "Color Code\nBy &"J + variable );
finish;
/* Press F11 in the plot window to see the menu. */

Statistics and Operations Research Home Page | SAS/IML Workshop