cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
ENTHU
Level IV

Multiplying values in a column.

I have a table as below.Need to find product of rows in each column to find the area of the rectangle.How can I do this?

Shape  

Rect1

Rect2

Rect3

 

Length 

5    

10

15 

Breadth   

2           

8         

6

Area         
2 REPLIES 2
txnelson
Super User

Re: Multiplying values in a column.

dt = current data table();

dt:Rect1[3] = dt:Rect1[1] * dt:Rect1[2];
dt:Rect2[3] = dt:Rect2[1] * dt:Rect2[2];
dt:Rect3[3] = dt:Rect3[1] * dt:Rect3[2];
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: Multiplying values in a column.

@txnelson has shown you a response that will give you exactly what you've asked for.

 

However, I'm curious exactly what you're trying to do? Using a JMP data table like a spreadsheet is like using a wrench as a hammer; it will drive some nails but you're likely to skin your knuckles.

 

A JMP data table is a more structured format than a spreadsheet. You'd be well advised to use it for what it's good for. In general, each row of a data table should represent a unique entity, similar to every other row, and each column should represent a single kind of measure on each of those entities.

 

In your example, take the data table you describe:

 

JMPScreenSnapz212.png

 

and recognize that you've got your entities (Rectangles) in the columns and your measures (Length, Breadth, Area) in the rows. 

 

If that's the way the data was handed to you, no problem. Just reshape it using Tables->Transpose and you end up with this.

 

JMPScreenSnapz213.png

 

Notice now you have one row for each Rectangle and one column for each measure. Now you can use the Formula Editor to multiply the Length and Breadth to compute the Area.

 

JMPScreenSnapz214.png

 

I hope that helps explain a bit about why it wasn't obvious how to multiply rows. Math across rows doesn't make sense for a JMP data table. After all, what would Distribution mean on data in that format?

 

JMPScreenSnapz215.png

 

 

-Jeff