Calculate the sum of a variable
up vote
2
down vote
favorite
I would like to calculate the sum of variable boasav
:
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
I know that the tabulate
command can be used to summarize data but it only counts:
bys id: tab boasav
-> id = 1
boasav | Freq. Percent Cum.
------------+-----------------------------------
2500 | 1 33.33 33.33
2900 | 1 33.33 66.67
4200 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
-> id = 2
boasav | Freq. Percent Cum.
------------+-----------------------------------
5700 | 1 50.00 50.00
6100 | 1 50.00 100.00
------------+-----------------------------------
Total | 2 100.00
-> id = 3
boasav | Freq. Percent Cum.
------------+-----------------------------------
7400 | 1 33.33 33.33
7600 | 1 33.33 66.67
8300 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
However, what I want is the following:
1 9600
2 11800
3 23300
Is there a function that can do this in Stata?
stata
New contributor
add a comment |
up vote
2
down vote
favorite
I would like to calculate the sum of variable boasav
:
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
I know that the tabulate
command can be used to summarize data but it only counts:
bys id: tab boasav
-> id = 1
boasav | Freq. Percent Cum.
------------+-----------------------------------
2500 | 1 33.33 33.33
2900 | 1 33.33 66.67
4200 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
-> id = 2
boasav | Freq. Percent Cum.
------------+-----------------------------------
5700 | 1 50.00 50.00
6100 | 1 50.00 100.00
------------+-----------------------------------
Total | 2 100.00
-> id = 3
boasav | Freq. Percent Cum.
------------+-----------------------------------
7400 | 1 33.33 33.33
7600 | 1 33.33 66.67
8300 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
However, what I want is the following:
1 9600
2 11800
3 23300
Is there a function that can do this in Stata?
stata
New contributor
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I would like to calculate the sum of variable boasav
:
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
I know that the tabulate
command can be used to summarize data but it only counts:
bys id: tab boasav
-> id = 1
boasav | Freq. Percent Cum.
------------+-----------------------------------
2500 | 1 33.33 33.33
2900 | 1 33.33 66.67
4200 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
-> id = 2
boasav | Freq. Percent Cum.
------------+-----------------------------------
5700 | 1 50.00 50.00
6100 | 1 50.00 100.00
------------+-----------------------------------
Total | 2 100.00
-> id = 3
boasav | Freq. Percent Cum.
------------+-----------------------------------
7400 | 1 33.33 33.33
7600 | 1 33.33 66.67
8300 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
However, what I want is the following:
1 9600
2 11800
3 23300
Is there a function that can do this in Stata?
stata
New contributor
I would like to calculate the sum of variable boasav
:
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
I know that the tabulate
command can be used to summarize data but it only counts:
bys id: tab boasav
-> id = 1
boasav | Freq. Percent Cum.
------------+-----------------------------------
2500 | 1 33.33 33.33
2900 | 1 33.33 66.67
4200 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
-> id = 2
boasav | Freq. Percent Cum.
------------+-----------------------------------
5700 | 1 50.00 50.00
6100 | 1 50.00 100.00
------------+-----------------------------------
Total | 2 100.00
-> id = 3
boasav | Freq. Percent Cum.
------------+-----------------------------------
7400 | 1 33.33 33.33
7600 | 1 33.33 66.67
8300 | 1 33.33 100.00
------------+-----------------------------------
Total | 3 100.00
However, what I want is the following:
1 9600
2 11800
3 23300
Is there a function that can do this in Stata?
stata
stata
New contributor
New contributor
edited Nov 10 at 15:39
Pearly Spencer
8,504163250
8,504163250
New contributor
asked Nov 10 at 15:26
Steve
162
162
New contributor
New contributor
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday
add a comment |
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Solution 1: calculate and present using the list
or table
commands
bysort id: list, sum(boasav)
-> id = 1
+-------------+
| id boasav |
|-------------|
1. | 1 2500 |
2. | 1 2900 |
3. | 1 4200 |
|-------------|
Sum | 9600 |
+-------------+
-> id = 2
+-------------+
| id boasav |
|-------------|
1. | 2 5700 |
2. | 2 6100 |
|-------------|
Sum | 11800 |
+-------------+
-> id = 3
+-------------+
| id boasav |
|-------------|
1. | 3 7400 |
2. | 3 7600 |
3. | 3 8300 |
|-------------|
Sum | 23300 |
+-------------+
table id, contents(sum boasav)
-----------------------
id | sum(boasav)
----------+------------
1 | 9600
2 | 11800
3 | 23300
-----------------------
Solution 2: generate extra variables with the results and then list
bysort id (boasav): generate sum1 = sum(boasav)
or
by id: egen sum2 = total(boasav)
Both of these approaches will produce the same results:
by id: list sum* if _n == _N
-> id = 1
+-------------+
| sum1 sum2 |
|-------------|
3. | 9600 9600 |
+-------------+
-> id = 2
+---------------+
| sum1 sum2 |
|---------------|
2. | 11800 11800 |
+---------------+
-> id = 3
+---------------+
| sum1 sum2 |
|---------------|
3. | 23300 23300 |
+---------------+
Solution 3: create a new dataset with the results and list
collapse (sum) boasav, by(id)
list
+-------------+
| id boasav |
|-------------|
1. | 1 9600 |
2. | 2 11800 |
3. | 3 23300 |
+-------------+
Note that this last solution will destroy your current dataset.
add a comment |
up vote
1
down vote
Here are three more.
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
* Method 4: use summarize
forval g = 1/3 {
su boasav if id == `g', meanonly
di "`g' " %5.0f r(sum)
}
1 9600
2 11800
3 23300
* Method 5: tabstat
tabstat boasav, by(id) stat(sum)
Summary for variables: boasav
by categories of: id
id | sum
---------+----------
1 | 9600
2 | 11800
3 | 23300
---------+----------
Total | 44700
--------------------
* Method 6: use rangestat (SSC)
rangestat (sum) boasav, int(id 0 0)
tabdisp id, c(boasav_sum)
-------------------------
id | sum of boasav
----------+--------------
1 | 9600
2 | 11800
3 | 23300
-------------------------
I had forgotten abouttabstat
!
– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact thatby
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?
– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions usingby:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies ofe(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.
– Nick Cox
Nov 12 at 17:04
|
show 2 more comments
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Solution 1: calculate and present using the list
or table
commands
bysort id: list, sum(boasav)
-> id = 1
+-------------+
| id boasav |
|-------------|
1. | 1 2500 |
2. | 1 2900 |
3. | 1 4200 |
|-------------|
Sum | 9600 |
+-------------+
-> id = 2
+-------------+
| id boasav |
|-------------|
1. | 2 5700 |
2. | 2 6100 |
|-------------|
Sum | 11800 |
+-------------+
-> id = 3
+-------------+
| id boasav |
|-------------|
1. | 3 7400 |
2. | 3 7600 |
3. | 3 8300 |
|-------------|
Sum | 23300 |
+-------------+
table id, contents(sum boasav)
-----------------------
id | sum(boasav)
----------+------------
1 | 9600
2 | 11800
3 | 23300
-----------------------
Solution 2: generate extra variables with the results and then list
bysort id (boasav): generate sum1 = sum(boasav)
or
by id: egen sum2 = total(boasav)
Both of these approaches will produce the same results:
by id: list sum* if _n == _N
-> id = 1
+-------------+
| sum1 sum2 |
|-------------|
3. | 9600 9600 |
+-------------+
-> id = 2
+---------------+
| sum1 sum2 |
|---------------|
2. | 11800 11800 |
+---------------+
-> id = 3
+---------------+
| sum1 sum2 |
|---------------|
3. | 23300 23300 |
+---------------+
Solution 3: create a new dataset with the results and list
collapse (sum) boasav, by(id)
list
+-------------+
| id boasav |
|-------------|
1. | 1 9600 |
2. | 2 11800 |
3. | 3 23300 |
+-------------+
Note that this last solution will destroy your current dataset.
add a comment |
up vote
1
down vote
accepted
Solution 1: calculate and present using the list
or table
commands
bysort id: list, sum(boasav)
-> id = 1
+-------------+
| id boasav |
|-------------|
1. | 1 2500 |
2. | 1 2900 |
3. | 1 4200 |
|-------------|
Sum | 9600 |
+-------------+
-> id = 2
+-------------+
| id boasav |
|-------------|
1. | 2 5700 |
2. | 2 6100 |
|-------------|
Sum | 11800 |
+-------------+
-> id = 3
+-------------+
| id boasav |
|-------------|
1. | 3 7400 |
2. | 3 7600 |
3. | 3 8300 |
|-------------|
Sum | 23300 |
+-------------+
table id, contents(sum boasav)
-----------------------
id | sum(boasav)
----------+------------
1 | 9600
2 | 11800
3 | 23300
-----------------------
Solution 2: generate extra variables with the results and then list
bysort id (boasav): generate sum1 = sum(boasav)
or
by id: egen sum2 = total(boasav)
Both of these approaches will produce the same results:
by id: list sum* if _n == _N
-> id = 1
+-------------+
| sum1 sum2 |
|-------------|
3. | 9600 9600 |
+-------------+
-> id = 2
+---------------+
| sum1 sum2 |
|---------------|
2. | 11800 11800 |
+---------------+
-> id = 3
+---------------+
| sum1 sum2 |
|---------------|
3. | 23300 23300 |
+---------------+
Solution 3: create a new dataset with the results and list
collapse (sum) boasav, by(id)
list
+-------------+
| id boasav |
|-------------|
1. | 1 9600 |
2. | 2 11800 |
3. | 3 23300 |
+-------------+
Note that this last solution will destroy your current dataset.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Solution 1: calculate and present using the list
or table
commands
bysort id: list, sum(boasav)
-> id = 1
+-------------+
| id boasav |
|-------------|
1. | 1 2500 |
2. | 1 2900 |
3. | 1 4200 |
|-------------|
Sum | 9600 |
+-------------+
-> id = 2
+-------------+
| id boasav |
|-------------|
1. | 2 5700 |
2. | 2 6100 |
|-------------|
Sum | 11800 |
+-------------+
-> id = 3
+-------------+
| id boasav |
|-------------|
1. | 3 7400 |
2. | 3 7600 |
3. | 3 8300 |
|-------------|
Sum | 23300 |
+-------------+
table id, contents(sum boasav)
-----------------------
id | sum(boasav)
----------+------------
1 | 9600
2 | 11800
3 | 23300
-----------------------
Solution 2: generate extra variables with the results and then list
bysort id (boasav): generate sum1 = sum(boasav)
or
by id: egen sum2 = total(boasav)
Both of these approaches will produce the same results:
by id: list sum* if _n == _N
-> id = 1
+-------------+
| sum1 sum2 |
|-------------|
3. | 9600 9600 |
+-------------+
-> id = 2
+---------------+
| sum1 sum2 |
|---------------|
2. | 11800 11800 |
+---------------+
-> id = 3
+---------------+
| sum1 sum2 |
|---------------|
3. | 23300 23300 |
+---------------+
Solution 3: create a new dataset with the results and list
collapse (sum) boasav, by(id)
list
+-------------+
| id boasav |
|-------------|
1. | 1 9600 |
2. | 2 11800 |
3. | 3 23300 |
+-------------+
Note that this last solution will destroy your current dataset.
Solution 1: calculate and present using the list
or table
commands
bysort id: list, sum(boasav)
-> id = 1
+-------------+
| id boasav |
|-------------|
1. | 1 2500 |
2. | 1 2900 |
3. | 1 4200 |
|-------------|
Sum | 9600 |
+-------------+
-> id = 2
+-------------+
| id boasav |
|-------------|
1. | 2 5700 |
2. | 2 6100 |
|-------------|
Sum | 11800 |
+-------------+
-> id = 3
+-------------+
| id boasav |
|-------------|
1. | 3 7400 |
2. | 3 7600 |
3. | 3 8300 |
|-------------|
Sum | 23300 |
+-------------+
table id, contents(sum boasav)
-----------------------
id | sum(boasav)
----------+------------
1 | 9600
2 | 11800
3 | 23300
-----------------------
Solution 2: generate extra variables with the results and then list
bysort id (boasav): generate sum1 = sum(boasav)
or
by id: egen sum2 = total(boasav)
Both of these approaches will produce the same results:
by id: list sum* if _n == _N
-> id = 1
+-------------+
| sum1 sum2 |
|-------------|
3. | 9600 9600 |
+-------------+
-> id = 2
+---------------+
| sum1 sum2 |
|---------------|
2. | 11800 11800 |
+---------------+
-> id = 3
+---------------+
| sum1 sum2 |
|---------------|
3. | 23300 23300 |
+---------------+
Solution 3: create a new dataset with the results and list
collapse (sum) boasav, by(id)
list
+-------------+
| id boasav |
|-------------|
1. | 1 9600 |
2. | 2 11800 |
3. | 3 23300 |
+-------------+
Note that this last solution will destroy your current dataset.
edited Nov 10 at 15:47
answered Nov 10 at 15:35
Pearly Spencer
8,504163250
8,504163250
add a comment |
add a comment |
up vote
1
down vote
Here are three more.
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
* Method 4: use summarize
forval g = 1/3 {
su boasav if id == `g', meanonly
di "`g' " %5.0f r(sum)
}
1 9600
2 11800
3 23300
* Method 5: tabstat
tabstat boasav, by(id) stat(sum)
Summary for variables: boasav
by categories of: id
id | sum
---------+----------
1 | 9600
2 | 11800
3 | 23300
---------+----------
Total | 44700
--------------------
* Method 6: use rangestat (SSC)
rangestat (sum) boasav, int(id 0 0)
tabdisp id, c(boasav_sum)
-------------------------
id | sum of boasav
----------+--------------
1 | 9600
2 | 11800
3 | 23300
-------------------------
I had forgotten abouttabstat
!
– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact thatby
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?
– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions usingby:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies ofe(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.
– Nick Cox
Nov 12 at 17:04
|
show 2 more comments
up vote
1
down vote
Here are three more.
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
* Method 4: use summarize
forval g = 1/3 {
su boasav if id == `g', meanonly
di "`g' " %5.0f r(sum)
}
1 9600
2 11800
3 23300
* Method 5: tabstat
tabstat boasav, by(id) stat(sum)
Summary for variables: boasav
by categories of: id
id | sum
---------+----------
1 | 9600
2 | 11800
3 | 23300
---------+----------
Total | 44700
--------------------
* Method 6: use rangestat (SSC)
rangestat (sum) boasav, int(id 0 0)
tabdisp id, c(boasav_sum)
-------------------------
id | sum of boasav
----------+--------------
1 | 9600
2 | 11800
3 | 23300
-------------------------
I had forgotten abouttabstat
!
– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact thatby
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?
– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions usingby:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies ofe(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.
– Nick Cox
Nov 12 at 17:04
|
show 2 more comments
up vote
1
down vote
up vote
1
down vote
Here are three more.
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
* Method 4: use summarize
forval g = 1/3 {
su boasav if id == `g', meanonly
di "`g' " %5.0f r(sum)
}
1 9600
2 11800
3 23300
* Method 5: tabstat
tabstat boasav, by(id) stat(sum)
Summary for variables: boasav
by categories of: id
id | sum
---------+----------
1 | 9600
2 | 11800
3 | 23300
---------+----------
Total | 44700
--------------------
* Method 6: use rangestat (SSC)
rangestat (sum) boasav, int(id 0 0)
tabdisp id, c(boasav_sum)
-------------------------
id | sum of boasav
----------+--------------
1 | 9600
2 | 11800
3 | 23300
-------------------------
Here are three more.
clear
input id boasav
1 2500
1 2900
1 4200
2 5700
2 6100
3 7400
3 7600
3 8300
end
* Method 4: use summarize
forval g = 1/3 {
su boasav if id == `g', meanonly
di "`g' " %5.0f r(sum)
}
1 9600
2 11800
3 23300
* Method 5: tabstat
tabstat boasav, by(id) stat(sum)
Summary for variables: boasav
by categories of: id
id | sum
---------+----------
1 | 9600
2 | 11800
3 | 23300
---------+----------
Total | 44700
--------------------
* Method 6: use rangestat (SSC)
rangestat (sum) boasav, int(id 0 0)
tabdisp id, c(boasav_sum)
-------------------------
id | sum of boasav
----------+--------------
1 | 9600
2 | 11800
3 | 23300
-------------------------
answered Nov 11 at 1:52
Nick Cox
24.4k42036
24.4k42036
I had forgotten abouttabstat
!
– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact thatby
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?
– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions usingby:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies ofe(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.
– Nick Cox
Nov 12 at 17:04
|
show 2 more comments
I had forgotten abouttabstat
!
– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact thatby
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?
– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions usingby:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies ofe(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.
– Nick Cox
Nov 12 at 17:04
I had forgotten about
tabstat
!– Pearly Spencer
Nov 12 at 15:21
I had forgotten about
tabstat
!– Pearly Spencer
Nov 12 at 15:21
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
Stata's tabulation commands are a bit of a mess. But producing a table isn't exactly a small or well-defined task. What of? is only the start.
– Nick Cox
Nov 12 at 16:34
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
There's considerable overlap between commands but that's not necessarily a bad thing. With tables it is hard to create a command to cater for all use cases. If you want to deviate even slightly from what is offered you need to program everything yourself.
– Pearly Spencer
Nov 12 at 16:56
What I find really annoying is the fact that
by
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?– Pearly Spencer
Nov 12 at 16:57
What I find really annoying is the fact that
by
does not return results from all groups but only the most recent one. How hard could had been for StataCorp to program it to return everything?– Pearly Spencer
Nov 12 at 16:57
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions using
by:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies of e(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.– Nick Cox
Nov 12 at 17:04
if that's really annoying then I don't where your scale extends to! But say you run 100000 regressions using
by:
. What do you expect to be available after them all? Stata provides lots of ways to save the results of 100000 regressions; just don't expect 100000 sets of results, including 100000 copies of e(sample)
, all to remain accessible. Conversely, letting r- and e-class estimates pile up isn't really in anyone's best interests. You still would have to write code to process them all.– Nick Cox
Nov 12 at 17:04
|
show 2 more comments
Steve is a new contributor. Be nice, and check out our Code of Conduct.
Steve is a new contributor. Be nice, and check out our Code of Conduct.
Steve is a new contributor. Be nice, and check out our Code of Conduct.
Steve is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240407%2fcalculate-the-sum-of-a-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you found my answer helpful, please also consider up-voting it using the upper arrow.
– Pearly Spencer
yesterday