Stata Collapse

The collapse command creates a dataset of summary statistics.


Usage

Given a dataset like:

id

foo

bar

baz

1

0

0

10

2

1

0

20

3

0

0

10

4

1

0

20

5

0

1

10

6

1

1

20

7

0

1

10

8

1

1

20

Running collapse (percent) foo (mean) baz, by(bar) would create a dataset like:

bar

foo

baz

0

50

15

1

50

15


Statistics

The collapse command is capable of computing any of:

The default statistic to compute is mean.


See also

Stata manual for collapse


CategoryRicottone

Stata/Collapse (last edited 2023-06-08 01:04:54 by DominicRicottone)