Dear all, I would really appreciate your help over the following issue that I've been struggling with:

I have the following dataset - please, see at the end - and I have to compute the standard deviation of earnings for the previous five years of the same quarter as the observation with a minimum of 3 observations.
For example, for AAA EPS of 2022Q1 I have to compute the sd of EPS of 2021Q1, 2020Q1,2019Q1,2018Q1,2017Q1.

Thank you,
Julia

****
Code:
input str6 ibtic float(fyear qrt EPS)    
"AAA" 2020 1    0
"AAA" 2021 1 -.06
"AAA" 2022 1  .01
"AAA" 2023 1 -.05
"AAA" 2024 1 -.18
"AAA" 2025 1  .33
"BBB" 2020 2 -.08
"BBB" 2021 2  .13
"BBB" 2022 2  -.1
"BBB" 2023 2 -.01
end