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
Nexgent3
Level I

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 ?

 

MonthProdCostNorm_Cost
JanA1001.00
FebA1021.02
MarchA1051.05
JanB251.00
FebB271.08
MarchB230.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

View solution in original post

1 REPLY 1
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

View solution in original post

Article Labels

    There are no labels assigned to this post.