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
Nesting replacement variables
Moderators: EViews Gareth, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Nesting replacement variables
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 25 guests