cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
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