Hey,

Using the help on other threads from Nick Cox I've been able to generate a variable that expresses the percentage change in price of house plants from one month to the next, with the code:
Code:
tsset price date
sort date
gen price_change = (price - price[_n-1]) / (price[_n-1])
However, what I'm trying to do is create the percentage change in price from January in 2018 (for the rest of the months in 2018), the change in price from January in 2019 (for the rest of 2019) and the same for 2020 - allowing for the comparison of monthly price changes across three separate years.

Any advice on how I might go about adjusting the code to get the desired outcome? I'm new to Stata and this is my first post, so I apologise if I'm posting in the wrong area etc.

Thanks!