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!
Related Posts with Calculate sum of values in a table
Treatment covariate interactionsHi, I'm running a model in which I have a two-arm treatment and a covariate interaction. The model …
Simple table export question: loop or by function?Hi everyone I am currently working on a monitoring and evaluation program where I need to create a …
Calculating rate and confidence interval for a series of data.Hello all I am doing some time series stuff (using R to do interrupted time series analysis - long …
Add string to empty cellHi all, I need add string (N/A) to empty cells for a string Variable, I used "subinstr", but lament…
Creating a more efficient loop for generating multiple datasetsHello Statalist, I am in the process of creating 718 different data files based off of one master d…
Subscribe to:
Post Comments (Atom)
0 Response to Calculate sum of values in a table
Post a Comment