The problem is that the output always shows a little or above it. For example, there are 10000 observations. I don't get exact 6000 observations as 0 and 4000 observations as 1.
My code:
set obs 10000
gen a = uniform()
gen b = 0
replace b = 1 if a <= 0.40
What is wrong with this? Or is there any alternative?
Related Posts with How do you generate a categorical variable which takes on values 0 and 1 in 60% and 40% observations respectively?
Error when testing for woodridge autocorrelation test on panel dataHello, I have been testing for the serial correlation using the Woodridge test but i seem to have t…
Equivalence between margins and predictnlHello, I am using Stata 17 to estimate the impact of variable X on a probability P. I run a regres…
Estimation of marginal effect of cmp_probitWhen I use cmp_probit estimation model, the tool variable coefficient exists, but the tool variable …
How to save a "line" graph in an Excel file?Hi, I would like to save the following graph in an Excel file: Code: * Example generated by -dat…
3 way interaction (continuous*continuous*binary dummy) interpretation + necessary testsHello everyone, I am currently working on a paper where a 3-way interaction is included in a panel …
Subscribe to:
Post Comments (Atom)
0 Response to How do you generate a categorical variable which takes on values 0 and 1 in 60% and 40% observations respectively?
Post a Comment