variables and path with the same name

For questions regarding programming in the EViews programming language.

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

Posts: 66
Joined: Thu Feb 17, 2011 9:50 am

variables and path with the same name

Postby RDS » Tue Mar 13, 2018 8:57 am

I am saving results of regressions containing x1, then, x2 and then x3, in subfolders with the respective names. This implies that for every regression I have two make two changes: the variable and the path name.

genr y = x1
'genr y = x2
'genr y = x3

%path ="P:Tables\x1"
'%path ="P:Tables\x2"
'%path ="P:Tables\x3"

Is it possible to have all in one go? Such as:
%path ="P:Tables\y"
but "P:Tables\y" should be "P:Tables\x1", "P:Tables\x2" or "P:Tables\x3" depending on the definition of y.

EViews Matt
EViews Developer
Posts: 328
Joined: Thu Apr 25, 2013 7:48 pm

Re: variables and path with the same name

Postby EViews Matt » Tue Mar 13, 2018 9:28 am


You can create a program variable containing the series name and use it to specify both y and %path. Taking this idea one step further, you could loop through all the series names:

Code: Select all

for %series x1 x2 x3
   genr y = {%series}
   %path = "P:Tables\" + %series

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests