Changing names of objects in a group

For questions regarding programming in the EViews programming language.

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

neilblake
Posts: 20
Joined: Tue Sep 30, 2008 4:19 am

Changing names of objects in a group

Postby neilblake » Thu May 23, 2024 2:54 pm

if a have a group g_base which contains X1_base X2_base X3_base etc, is there an easy way to create a group G_ALT from it which is comprised of X1_alt X2_alt X3_alt etc?

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

Re: Changing names of objects in a group

Postby EViews Gareth » Thu May 23, 2024 3:02 pm

Code: Select all

wfcreate u 100

for !i=1 to 3
   series x{!i}_base
   series x{!i}_alt
next

group g_base *base


group g_alt
%list = g_base.@members
for %j {%list}
   %prefix = @left(%j, @instr(%j, "_"))
   %new = %prefix + "alt"
   g_alt.add {%new}
next
Follow us on Twitter @IHSEViews

neilblake
Posts: 20
Joined: Tue Sep 30, 2008 4:19 am

Re: Changing names of objects in a group

Postby neilblake » Thu May 23, 2024 4:13 pm

Could I use this to create a group where the member are just x1, X2, X3 etc rather than X1_alt, X2_alt, X3_alt etc?

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

Re: Changing names of objects in a group

Postby EViews Gareth » Thu May 23, 2024 4:47 pm

Yes, just change the %new line
Follow us on Twitter @IHSEViews

neilblake
Posts: 20
Joined: Tue Sep 30, 2008 4:19 am

Re: Changing names of objects in a group

Postby neilblake » Thu May 23, 2024 11:14 pm

change it to what?


Return to “Programming”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 48 guests