Stata Contract
The contract command creates a dataset of descriptive statistics.
Contents
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