Help for renaming element in a table

For questions regarding programming in the EViews programming language.

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

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

Help for renaming element in a table

Postby sudesh » Mon Mar 12, 2018 8:49 am

Hi,

I would like to rename the element of a table from BB00 to Scenario_E_150_S_0.

I tried to use the rename command however it's not working.

rename tableTdate : : BB00 tableTdate : :Scenario_E_150_S_0

Any help will be greatly appreciated.

My table is as follows

Scenario TypeZscore Position Modèle Devise Pays Début Fin Nombre d'année
BB00 exp rl gsd USD CN 4/05/1974 9/27/1974 0.479452
BB00 exp rl gsd USD CN 10/14/1977 3/13/1987 9.416438
BB00 exp rl gsd USD CN 7/08/1994 10/29/2004 10.31781
BB00 exp rl gsd USD CN 1/15/2016 2/09/2018 2.071233
BB25 exp rl gsd USD CN 4/05/1974 9/27/1974 0.479452
BB25 exp rl gsd USD CN 10/14/1977 4/15/1983 5.504110
BB25 exp rl gsd USD CN 3/08/1985 1/30/1987 1.898630
BB25 exp rl gsd USD CN 7/08/1994 10/17/2003 9.282192
BB25 exp rl gsd USD CN 1/15/2016 4/22/2016 0.268493
BB50 exp rl gsd USD CN 4/05/1974 9/27/1974 0.479452
BB50 exp rl gsd USD CN 10/14/1977 10/29/1982 5.043836
BB50 exp rl gsd USD CN 3/08/1985 4/25/1986 1.131507
BB50 exp rl gsd USD CN 7/08/1994 6/06/2003 8.917808
BB50 exp rl gsd USD CN 1/15/2016 4/08/2016 0.230137
BB75 exp rl gsd USD CN 4/05/1974 5/17/1974 0.115068
BB75 exp rl gsd USD CN 8/30/1974 9/27/1974 0.076712
BB75 exp rl gsd USD CN 10/14/1977 12/25/1981 4.200000
BB75 exp rl gsd USD CN 3/08/1985 3/28/1986 1.054795
BB75 exp rl gsd USD CN 7/08/1994 5/09/2003 8.841096
BB75 exp rl gsd USD CN 1/15/2016 3/04/2016 0.134247

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

Re: Help for renaming element in a table

Postby EViews Matt » Mon Mar 12, 2018 9:10 am

Hello,

The rename command is for renaming objects, not elements within objects (and the :: syntax is for accessing objects in databases). However, you can loop through the table and use @replace to similar effect:

Code: Select all

for !i = 1 to @rows(tableTdate)
   tableTdate(!i, 1) = @replace(tableTdate(!i, 1), "BB00", "Scenario_E_150_S_0")
next

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

Re: Help for renaming element in a table

Postby sudesh » Mon Mar 12, 2018 10:45 am

Thanks alots, it's working


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 22 guests