cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
Ctron87
Level II

Create columns with 'Steps' and 'Runs' based on column with sequential numbers but varying rows, 'Steps' repeat every 4th number.

Having a tough time trying to word this question! But I have a data set, 'Sample', that start at 1 and is continuous but number of rows per value is not consistent (ie. 1,1,1,2,2,3,3,3,3,4,4,5...). Format for sample and desired columns below. Thanks!

 

 

SampleStep # (desired)Run # (desired)
111
111
221
331
331
441
512
512
622
732
732
732
732
842
913
913
913
1023
1023
1023
1133
1243
1243
1243
1314
1424
1534
1644
1644
4 REPLIES 4
jthi
Super User

Re: Create columns with 'Steps' and 'Runs' based on column with sequential numbers but varying rows, 'Steps' repeat every 4th number.

You can get steps using Mod()

Mod(:Sample - 1, 4) + 1

and run with division and Ceiling()

Ceiling(:Sample / 4)

 

-Jarmo
Ctron87
Level II

Re: Create columns with 'Steps' and 'Runs' based on column with sequential numbers but varying rows, 'Steps' repeat every 4th number.

That worked. Thanks!

bculver
Level II

Re: Create columns with 'Steps' and 'Runs' based on column with sequential numbers but varying rows, 'Steps' repeat every 4th number.

Assuming your data is consistent with the sample data, with 4 samples per run, here are two simple formulas

New Column("Step", Numeric, "Continuous", Format("Best", 12), Formula(1 + Mod(:Sample - 1, 4)));
New Column("Run", Numeric, "Continuous", Format("Best", 12), Formula(Ceiling(:Sample / 4)));

 

Ctron87
Level II

Re: Create columns with 'Steps' and 'Runs' based on column with sequential numbers but varying rows, 'Steps' repeat every 4th number.

Thank you!