Here is the Scripting Index description of the Col Sum()
![txnelson_0-1712133647011.png txnelson_0-1712133647011.png](https://community.jmp.com/t5/image/serverpage/image-id/63016iD229A13F1E29FE76/image-dimensions/672x237?v=v2)
Note that the function allows for By Variables. Example 4 from the same Scripting Index entry, illustrates the use of the By variables with columns Age and Sex specified as By variables
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "Sum for Each Age and Sex Group",
Formula( Col Sum( :height, :age, :sex ) )
);
With the results
![txnelson_1-1712133980667.png txnelson_1-1712133980667.png](https://community.jmp.com/t5/image/serverpage/image-id/63017iF561941010B8BDDA/image-dimensions/719x554?v=v2)
Jim