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
hogi
Level XIII

Parse in substitute

In Substitute, if I don't have a fixed number of symbols, is it possible to use a for loop and parse to generate the symbol names?

Something is wrong here:

 

myExpr=Expr(sum());
For( i=1, i<=10, i++, Insert Into (myExpr,parse("__x"||Char(i)||"__")));
Show(NameExpr(myExpr));
For( i=1, i<=10, i++, substitute (Name Expr(myExpr),parse("__x"||Char(i)||"__"),parse("y"||Char(i))));
Show(NameExpr(myExpr));
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Parse in substitute

You aren't updating the value of myExpr

Names Default To Here(1);

myExpr = Expr(Sum());
For(i = 1, i <= 10, i++,
	Insert Into(myExpr, Parse("__x" || Char(i) || "__"))
);
Show(Name Expr(myExpr));
For(i = 1, i <= 10, i++,
	myExpr = Substitute(Name Expr(myExpr), Parse("__x" || Char(i) || "__"), Parse("y" || Char(i)))
);
Show(Name Expr(myExpr));
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Parse in substitute

You aren't updating the value of myExpr

Names Default To Here(1);

myExpr = Expr(Sum());
For(i = 1, i <= 10, i++,
	Insert Into(myExpr, Parse("__x" || Char(i) || "__"))
);
Show(Name Expr(myExpr));
For(i = 1, i <= 10, i++,
	myExpr = Substitute(Name Expr(myExpr), Parse("__x" || Char(i) || "__"), Parse("y" || Char(i)))
);
Show(Name Expr(myExpr));
-Jarmo
hogi
Level XIII

Re: Parse in substitute

oh, so close!

Recommended Articles