Nesting replacement variables

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

mamo
Posts: 127
Joined: Wed Nov 07, 2012 9:11 am

Nesting replacement variables

Postby mamo » Tue Nov 04, 2014 10:47 am

Dear followers,

I found that replacement variables can be nested, and I would like to share my finding here.
I use Eviews 8; however the trick should be applicable with earlier (later) versions as well.
'---
%v1="v2"
%v2="v3"
series v3=100
'--
%v1 refers to the contents of the string variable %v1: "v2"
%{%v1} refers to the contents of the string variable %v2: "v3"
{%{%v1} } refers to the object with the name v3, i.e. the series v3

possible pseudo application
'---
%groups="gr1 gr2 gr3"
%gr1_m="m11 m12 m13"
%gr2_m="m21 m22 m23 m34"
%gr3_m="m31 m32"
for %gr {%groups}
for %grm {%{%gr}_m}
' Do something with m[ij], as referred to by %grm
next
next
'---
I also found that nesting by more than two levels is feasable, i.e.: {%{%{%v1}}},
but nesting by more than two levels may be of less relevance in practical applications.

Best, mamo

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

Re: Nesting replacement variables

Postby EViews Gareth » Tue Nov 04, 2014 10:54 am

This isn't possible pre-EViews 7.1, I believe.
Follow us on Twitter @IHSEViews


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 6 guests