Naming variables using control var. in 2 nested for-loops

For questions regarding programming in the EViews programming language.

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

todec
Posts: 2
Joined: Wed Nov 11, 2015 1:24 am

Naming variables using control var. in 2 nested for-loops

Postby todec » Wed Nov 11, 2015 1:44 am

Hello everyone,

I am used to a lot of programming language but unfortunately, never dug too deep into the eviews language. Unfortunately, I am facing a problem that I do not find any answer to. The problem is quite simple, but I guess the answer is not.
I estimate multiple subsamples of a dataset using a for-loop with variable !ss as the control variable. However, I have to estimate each subsample for different interest rates. Therefore, I have a nested for-loop within the (subsample-)for-loop with {%y} as the control variable.

Within the nested for-loop, I want to copy the system for the subsample for each interest rate. The code is:
copy halv_est_dyn_!ss halv_est_dyn_!ss_{%y}
However, I get the error message that "HALV_EST_DYN_!SS_001 is an illegal or reserved name in COPY HALV_EST_DYN_1 HALV_EST_DYN_!SS_001".

I presume that it is impossible to name variables using both control variables of two nested for-loops, as it works in non-nested for loops for both control variables. Can anyone confirm this presumption or does anyone know a nice work-around? I'd be very grateful for any advice. Otherwise, I will have to hard code one of the for-loops :-(

Thanks and kind regards, Christian

todec
Posts: 2
Joined: Wed Nov 11, 2015 1:24 am

Re: Naming variables using control var. in 2 nested for-loop

Postby todec » Wed Nov 11, 2015 2:08 am

Okay, it seems to work, if i switch positions of !ss and {%y}:
copy halv_est_dyn_!ss halv_est_dyn_{%y}_!ss

Thought I tried that at least three times over the past hours... but, this time it works. :-)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest