Dear all,

I am currently working with a dataset where I would like to get the sum of values with certain characteristics.

This is my code:

list country obstime sector obsvalue

foreach var of varlist country obstime sector obsvalue {
keep if country == "DEU"
keep if sector == "AGR"
drop if qdate < 240
}

if I execute the code, I get the following table:


country obstime sector obsvalue

1. DEU 2020-Q1 AGR 4329.4
2. DEU 2020-Q2 AGR 4290.1


Now I would like to calculate the total of obsvalues. I tried different options but I am still stuck at this point. Does anyone know how to do this?

I would appreciate any kind of help. Thank you in advance!