cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Create a column with a specific data pattern

I want to add a column to my data that changes from "1" values to "-1" values every 101 rows.  I saw lots of ways to get close but no solution yet.  Help appreciated.


Slán



SpannerHead
2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Create a column with a specific data pattern

You can do this with different combinations of Row(), Mod(), Floor(), Ceiling()... Here is one example which might do what you are looking for

1 - 2 * Mod(Floor((Row() -1) / 100), 2)
-Jarmo

View solution in original post

shampton82
Level VII

Re: Create a column with a specific data pattern

Hey @SpannerHead ,

These are always fun challenges since there are so many options!

 

Here another way besides @jthi excellent method

If( Row() < 101,
	1,
	Lag( :Column 1, 100 ) * -1
)

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Create a column with a specific data pattern

So you wish to have repeating pattern of 1, 0.98, 0.96,... -0.96, -0.98, -1?

-Jarmo
jthi
Super User

Re: Create a column with a specific data pattern

Or first 100 rows of 1 and then 100 rows of -1?

-Jarmo
SpannerHead
Level VI

Re: Create a column with a specific data pattern

Jarmo

 

Second one exactly.


Slán



SpannerHead
jthi
Super User

Re: Create a column with a specific data pattern

You can do this with different combinations of Row(), Mod(), Floor(), Ceiling()... Here is one example which might do what you are looking for

1 - 2 * Mod(Floor((Row() -1) / 100), 2)
-Jarmo
shampton82
Level VII

Re: Create a column with a specific data pattern

Hey @SpannerHead ,

These are always fun challenges since there are so many options!

 

Here another way besides @jthi excellent method

If( Row() < 101,
	1,
	Lag( :Column 1, 100 ) * -1
)

Recommended Articles