cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use JMP Live to centralize and share reports within groups. Webinar with Q&A April 4, 2pm ET.
Choose Language Hide Translation Bar
View Original Published Thread

Convert every number in a list or matrix to strings

reallyneedhelp
Level III

Hi everyone, just out of curiosity, I wonder if there is a way to convert every numbers in a list to strings?

For eg, I have a list:

listsss = {1, 4, 56, 72, 8, 9, 10};

and I want to convert them into:

listsss = {"1", "4", "56", "72", "8", "9", "10"};

Is there any way to do it by JSL? Any comments will be appreciated. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User


Re: Convert every numbers in a list to strings

L = {10, 200, 3000};
For( i = 1, i <= N Items( L ), i += 1,
	L[i] = Char( L[i] )
);
Show( L );

L = {"10", "200", "3000"};

Craige

View solution in original post

3 REPLIES 3
Craige_Hales
Super User


Re: Convert every numbers in a list to strings

L = {10, 200, 3000};
For( i = 1, i <= N Items( L ), i += 1,
	L[i] = Char( L[i] )
);
Show( L );

L = {"10", "200", "3000"};

Craige
reallyneedhelp
Level III


Re: Convert every numbers in a list to strings

@Craige_Hales This is perfect. Thank you!

Craige_Hales
Super User


Re: Convert every numbers in a list to strings

In JMP 16 you can use Transform Each() like this

L = {10, 200, 3000};
L = Transform Each( {v}, L, Char( v ) );
Show( L );

By default the output container matches the input container. You can use output(...) to control it:

L = [10, 200, 3000]; // actually, an array or matrix, not a list
L = Transform Each( {v}, L, output( "list" ), Char( v ) );
Show( L ); // L = {"10", "200", "3000"};

For huge lists and matrices, this will perform a little better than the plain for loop.

Craige