Page 1 of 1

Leading a variable

Posted: Tue Mar 21, 2023 4:30 am
by MartinsFest
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.

Re: Leading a variable

Posted: Tue Mar 21, 2023 5:47 am
by MartinsFest
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