Site icon Stata.Professor : Your Partner in Research

Reply To: rolling command panel data

This can be easily done using asrol. Let's assume that your panel identifier is id and time identifier is year. The asrol code you would use is given below.
bysort id : asrol ebitda, gen(sd_ebitda) stat(sd) window(year 4) min(4)
The min(4) option ensures that at least 4 observations are available for the calculation of the standard deviation.
Exit mobile version