Hi,

I am new to Stata and have been trying to plot the standard deviation of my whole sample and that of one subgroup.


This is my code:

bysort year: egen y_sd=sd(y)
by year: egen y_sd_EU15=sd(y) if EU15==1
label var y_sd "Standard deviation of real GDP per capita"
label var y_sd_EU6 "Standard deviation of real GDP per capita - EU15"
tsline y_sd y_sd_EU15 if year>=1995, xlabel (1995(10)2018)


After the bysort command "type mismatch" pops up.


Could someone please help?

Kat