Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted

## Normalization with a matching Criteria

Hi,

I just started using JMP. I would really appreciate your help. I wanted to normalize the Cost factor to Jan value by Product matching criteria and add it to a Norm_Cost column.

Basically Product A needs be normalized by 100 and Product B by 25. What can i enter in the formula column or a jsl script ?

 Month Prod Cost Norm_Cost Jan A 100 1.00 Feb A 102 1.02 March A 105 1.05 Jan B 25 1.00 Feb B 27 1.08 March B 23 0.92
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Normalization with a matching Criteria

I'm not the best scripter, but this should work as long as your data table is sorted by Month and Prod like your example table.

``````dt = Current Data Table();

dt << New Column("NormCost",
"Numeric",
"Continuous");

For( i=1, i <= N Rows(dt), i++,

If (:Month[i]=="Jan",

denom=:Cost[i];
:NormCost[i]=:Cost[i]/denom,

:NormCost[i]=:Cost[i]/denom
)
)``````

Dan Obermiller
Highlighted

## Re: Normalization with a matching Criteria

I'm not the best scripter, but this should work as long as your data table is sorted by Month and Prod like your example table.

``````dt = Current Data Table();

dt << New Column("NormCost",
"Numeric",
"Continuous");

For( i=1, i <= N Rows(dt), i++,

If (:Month[i]=="Jan",

denom=:Cost[i];
:NormCost[i]=:Cost[i]/denom,

:NormCost[i]=:Cost[i]/denom
)
)``````

Dan Obermiller
Article Labels

There are no labels assigned to this post.