Skip to main content
added 305 characters in body
Source Link
user5644
user5644

In Stata, you can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

This code creates left-bounded intervals, i.e. including the lower bound, but excluding the upper bound.

If you prefer the count approach, you can use the following code:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

Note that the inrange function refers to left-bounded intervals too.

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs

In Stata, you can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

If you prefer the count approach:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs

In Stata, you can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

This code creates left-bounded intervals, i.e. including the lower bound, but excluding the upper bound.

If you prefer the count approach, you can use the following code:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

Note that the inrange function refers to left-bounded intervals too.

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs
added 10 characters in body
Source Link
user5644
user5644

YouIn Stata, you can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

If you prefer the count approach:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs

You can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

If you prefer the count approach:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs

In Stata, you can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

If you prefer the count approach:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs
Source Link
user5644
user5644

You can achieve this as follows:

clear
set seed 99
set obs 1000
gen inc = 10000 * exp(invnorm(uniform()))
gen lb = floor(inc/10000) * 10000
tabulate lb

If you prefer the count approach:

forvalues n = 0(10000)280000 {
    count if inrange(inc, `n', `n' + 10000)
}

If you need a table to be inserted in a document, you can add the following lines:

collapse (count) N = inc, by(lb)
gen interval = "[" + string(lb) + ";" + string(lb + 10000) + ")" 
list interval N, sep(0) noobs