Page 1 of 1

String Loop on Existing String Variable

Posted: Thu Feb 18, 2016 7:59 am
by diggetybo
Hello again,

I have a question on the following code:

Code: Select all

%labels = "height width length weight density" %labels_xys = %labels for %i height width length weight density %labels_xys = @replace(%labels_xys, %i, %i+"_x "+%i+"_y ") next
Can I somehow use a string loop on an existing string variable that I declared so I don't have to type them all one by one? In another scenario, suppose that the string variable is updated then because my string loop doesn't know, it will only loop through the strings I manually typed there originally.

I tried:

Code: Select all

for %i %labels
But that didn't work.

Leave a line if you got an idea.

Thanks for reading

Re: String Loop on Existing String Variable

Posted: Thu Feb 18, 2016 10:43 am
by EViews Gareth

Code: Select all

for %i {%labels}

Re: String Loop on Existing String Variable

Posted: Thu Feb 18, 2016 10:58 am
by diggetybo
easy as that, thank you!