cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

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