Differences between revisions 1 and 2
Revision 1 as of 2023-06-07 19:36:27
Size: 1312
Comment:
Revision 2 as of 2023-06-08 01:04:44
Size: 1419
Comment:
Deletions are marked like this. Additions are marked like this.
Line 47: Line 47:
----



== See also ==

[[https://www.stata.com/manuals/dcontract.pdf|Stata manual for contract]]

Stata Contract

The contract command creates a dataset of descriptive 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 contract foo bar would create a dataset like:

foo

bar

_freq

0

0

2

0

1

2

1

0

2

1

1

2

To rename the frequency variable, try the freq(varname) option.


Statistics

The contract command can compute additional descriptive statistics using these option:

  • cfreq(varname) creates a cumulative frequency, increasing over rows

  • percent(varname) creates a percentage for each row

  • cpercent(varname) creates a cumulative percentage, increasing over rows


See also

Stata manual for contract


CategoryRicottone

Stata/Contract (last edited 2023-06-08 01:04:44 by DominicRicottone)