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
renaming using loop Code: * Example generated by -dataex-. To install: ssc install dataex clear input str43 Q2_8a1 dou…
Binscatter2 - faster, enhanced binned scatterplots in StataHi all, I wanted to make note of a program that I've had available on GitHub for a while now to gen…
creating a variable that takes a value of the difference of the last non-missing value and the first non-missing value in panel datai have panel time series. I want to create a variable that is the difference between the last non-mi…
How does one put formatted date labels into excel with Putexcel?*Hi there, Here's my code: local vars "date" foreach pre in `vars'{ putexcel set "tabout/cleaning…
Extracting a specific part of a string if the string contains an exact syntaxOK, so I'm not explaining this very well but here is what I want to do. I have data as shown below. …
Subscribe to:
Post Comments (Atom)
0 Response to Calculate sum of values in a table
Post a Comment