Here are a couple of ways to do what I think you are looking for
Names Default To Here( 1 );
dt = Current Data Table();
Summarize( dt, fruitName = by( :fruit ) );
runTime = 5;
run = [](0, 2);
fruitList ={};
For( i = 1, i <= N Items( fruitName ), i++,
r = dt << get rows where( :fruit == fruitName[i] );
For( j = 1, j <= runTime, j++,
insert into(fruitList, fruitName[i]);
row = r[Random Integer( nrows(r))];
run |/= Matrix( {{j, dt:name( "price hi" )[row] - dt:price lo[row]}} );
);
);
dtNew = New Table("Random",
add rows(n rows(run)),
new column("Fruit", character,set each value(fruitList[Row()])),
new column("Delta", set each value(run[row(),2]))
);
// or
dtNew2 = dt << Subset(
Sample Size( runTime ),
Selected columns only( 0 ),
Stratify( :fruit )
);
dtNew2 << New Column( "Delta", set each value( :price hi - :price lo ) );
dtNew2 << delete columns( {"price hi", "price lo"} );
Jim