cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
natalie_
Level V

How to apply a formula to an existing column with a variable name?

Hi all,

I would like to apply the same formula to multiple existing columns in my data table using JSL. 

I have one column that says 0V and the other that says RP_0V.  I would like to apply a formula to column RP_0V using the 0V column.  I have to do this many times (for column RP_10V using the column 10V, etc.)

I am having a lot of trouble figuring out the syntax for it, and I bet it is pretty simple...

for(i=0, i<=65, i++,

  colName =Column(char(i*10)||"V");

  dtSummary:("RP_"||char(i*10)||"V") = Formula(100*Col Rank(:colName)/1006);

);

1 ACCEPTED SOLUTION

Accepted Solutions
natalie_
Level V

Re: How to apply a formula to an existing column with a variable name?

I got it to work!  My main problem was that I wasn't using ​AsColumn​. 

for(i=0, i<=0, i++,

  colName =Column(char(i*10)||"V");

  colRP=("RP_"||char(i*10)||"V");

  Column(colRP) <<Formula((100*Col Rank(:AsColumn(colName))/(1006)));

);

View solution in original post

1 REPLY 1
natalie_
Level V

Re: How to apply a formula to an existing column with a variable name?

I got it to work!  My main problem was that I wasn't using ​AsColumn​. 

for(i=0, i<=0, i++,

  colName =Column(char(i*10)||"V");

  colRP=("RP_"||char(i*10)||"V");

  Column(colRP) <<Formula((100*Col Rank(:AsColumn(colName))/(1006)));

);

Recommended Articles