Leading a variable

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

Moderators: EViews Gareth, EViews Moderator

MartinsFest
Posts: 27
Joined: Tue Dec 13, 2022 4:41 am

Leading a variable

Postby MartinsFest » Tue Mar 21, 2023 4:30 am

Hello,

I want to lead several variables, as well as keeping all their attributes. I also want to keep their original names. The purpose is to align day-ahead prices with the date they are active.

The following code does not work, it creates only NA-values:

Code: Select all

for %sname {%eviewsname}
   genr {%sname} = {%sname}(-1)
next


Tried using the @lag-operator, giving this error message:
Illegal @MOV???, @LAG, @CAGR, or @PCAGR specification in
"GENR {%SNAME} = @LAG(NOK_ELSP_PRI_ARE_H_NO1_1, -1)"
in PRISSTATISTIKK.PRG on line 18.


I have tried a few other variations, and would like some advice on how to achieve what I want, as I don't seem to be able to.

MartinsFest
Posts: 27
Joined: Tue Dec 13, 2022 4:41 am

Re: Leading a variable

Postby MartinsFest » Tue Mar 21, 2023 5:47 am

Never mind. The mistake and solution was glaring in my face. Don't even want to mention it.

Code I am using at the moment. Please do tell if any improvements can be made.

Code: Select all

for %sname {%eviewsname}
   {%sname}.ipolate {%sname}_lin
   {%sname} = {%sname}_lin(-1)
   delete *_lin
next


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 22 guests