Hi,
I am fairly new to scripting in JMP and have looked through many jmp forums for solutions but haven't been successful in modifying the solutions for my particular problem.
I have a script that produces a table of unknown number of columns and want to multiply each value in the row (there is only one row in the table generated) across the columns produced (column 1 * column 2 * column 3* etc). I simplified the table for the example, the actual table could have many more columns.
My loop multiplies each row by the next one but doesn't give me the final answer of all the rows multiplied by each other. I also just want the end product of all the values multplied together and don't need the product of each incremental value. Any help is very much appreciated.
New Table( "tsp",
Add Rows( 1 ),
New Column( "Row 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0.975] )
),
New Column( "Row 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0.985] )
),
New Column( "Row 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0.983] )
),
New Column( "Row 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [0.839] )
),
);
Ncol = N col(tsp);
For( i = 1, i <= Ncol, i++,
For( j = i + 1, j <= Ncol, j++,
RTP = Eval( Column( i ) << Get Name ) || " * " || Eval( Column( i+=1 ) << Get Name );
New Column( RTP, Numeric , seteachvalue( Column( i )[] * Column( i+=1 )[]) );
)
);