cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

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