Subscribe Bookmark RSS Feed

Iterating within a Column Formula

jdkurtis

New Contributor

Joined:

Dec 14, 2016

Hi All-

New JMP scripter here... I've been trying to create a Column Formula that would copy the value from another Column and paste it in X number of rows. I am able to get this to work using several intermediary columns, but this is super tedious. I have tried looping iterations using Local variables as counters, but have not gotten it to work. Specifically, (referencing the attached .xlsx file) If Antibody Value is not missing, I want it copied down 20 weeks (20 rows) in Antibody Value carried forward 20 wks.

 

Note- the copy down must respect the study ID- ie- only copy down the value if the study ID has not changed....

 

thx for any help with this.

best

jake

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a formula that works

If( Is Missing( :Antibody Value ) == 0,
	storeValue = :Antibody Value;
	rowValue = Row();
	idValue = :Study ID;
);
If( Row() - rowValue < 20 & :Study ID == idValue,
	storeValue,
	.
);

One can loop down and set values as you suggest, however since JMP is going to process down through all rows, it is just simpler to let JMP do the looping. 

Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a formula that works

If( Is Missing( :Antibody Value ) == 0,
	storeValue = :Antibody Value;
	rowValue = Row();
	idValue = :Study ID;
);
If( Row() - rowValue < 20 & :Study ID == idValue,
	storeValue,
	.
);

One can loop down and set values as you suggest, however since JMP is going to process down through all rows, it is just simpler to let JMP do the looping. 

Jim
jdkurtis

New Contributor

Joined:

Dec 14, 2016

Brilliant- works perfectly- and so clean... thx so much...

 

best

jake