cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

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

Remove word from list

Hi! I am trying to remove the word "none" from my lists ( which is variable according to the data input), but after running the script I see no changes in my output. Do you guys have any suggestion on how I can improve my code? 

unique= Associative Array(Data) << Get Keys;
show(unique); // output- unique= {" BGG", " BSG", "None"}
       Number= nitems(unique);
	for( i= 1, i >= Number, i++,
		if (unique[i]== "None",
		    remove from(unique,unique[i]);,
		);
	);
	

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Remove word from list

Here is how you want to handle your issue.  By working backwards down the list, you do not get the reference to the list incorrect because of deleting members of the list.

unique = {" BGG", " BSG", "None"};
For( i = N Items( unique ), i >= 1, i--,
	If( unique[i] == "None",
		Remove From( unique, i, 1 ), 

	)
);
Show( unique );
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Remove word from list

Here is how you want to handle your issue.  By working backwards down the list, you do not get the reference to the list incorrect because of deleting members of the list.

unique = {" BGG", " BSG", "None"};
For( i = N Items( unique ), i >= 1, i--,
	If( unique[i] == "None",
		Remove From( unique, i, 1 ), 

	)
);
Show( unique );
Jim

Recommended Articles