String Loop on Existing String Variable

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

String Loop on Existing String Variable

Postby diggetybo » Thu Feb 18, 2016 7:59 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: String Loop on Existing String Variable

Postby EViews Gareth » Thu Feb 18, 2016 10:43 am

Code: Select all

for %i {%labels}

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: String Loop on Existing String Variable

Postby diggetybo » Thu Feb 18, 2016 10:58 am

easy as that, thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests