cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • 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!
  • 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
user8421
Level II

How to repeat values in a column when they are strings

Hi everyone!

I've used this script below for numerical values

If( Is Missing( :Name( "For Calc - Data1" ) ),
	Lag( :Name( "Data1" ), 1 ),
	:Name( "For Calc - Data1" )
)


With the resulting table looking like this

For Calc - Data1 Data1
12 12
  12
  12
33 33
  33

 

 

However I can't apply this same formula to a column that has strings or characters to result in the following data table because I get an error saying that the value must be Numeric.

For Calc - Data2 Data2
A A
  A
  A
B B
  B

 

 

Is there a workaround or an alternative formula I can use to achieve this?

1 REPLY 1
txnelson
Super User

Re: How to repeat values in a column when they are strings

Here is the method I use

If( Row() == 1,
	x = :"For Calc - Data2"n
);
If( As Column( "For Calc - Data2" ) != "",
	x = :"For Calc - Data2"n
);
x;
Jim

Recommended Articles