I would like to write the code to construct the following variable.

Cost stickiness it = π‘™π‘œπ‘”(Ξ”Cost / Ξ”π‘†π‘Žπ‘™π‘’)𝑖,𝜏1–π‘™π‘œπ‘”(Ξ”Cos t / Ξ”π‘†π‘Žπ‘™π‘’)𝑖,𝜏2

𝜏1,𝜏2 ∈ {𝑑−1,…,𝑑−5} where 𝜏1 is the most recent of the last five years with an increase in sales and 𝜏2 is the most recent of the last five years with a decrease in sales;


Does anyone know how to write this code?

Thank you in advance!!