Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Unexpected -egen , fill()- behavior


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   st: Unexpected -egen , fill()- behavior
Date   Sun, 03 Dec 2006 01:03:33 +0900

There's undoubtedly something obvious why the numlist below doesn't give me
five groups of four each.  Can anyone point out where I'm going wrong?

Joseph Coveney

. set seed `=date("2006-12-03", "ymd")'

. drawnorm y x, corr(1 0.5 \ 0.5 1) n(20) clear
(obs 20)

. sort x

. egen byte group = fill(1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5)

. list, noobs sepby(group)

 +-------------------------------+
 |         y           x   group |
 |-------------------------------|
 |  -1.04372   -2.458569       1 |
 | -.6301845    -1.53749       1 |
 | -.4474874   -1.227146       1 |
 |  -.538601   -1.158167       1 |
 |-------------------------------|
 |  .0999929   -1.140627       2 |
 | -.7626165   -1.040885       2 |
 | -.8379411   -.9000927       2 |
 | -1.199746   -.8086246       2 |
 |-------------------------------|
 | -.2398437   -.6472539       3 |
 |  .4926107   -.6277131       3 |
 |  .3099134   -.5799699       3 |
 |  .7792414   -.4452717       3 |
 |  .5397932   -.1693323       3 |
 |  .6346364   -.1348845       3 |
 |-------------------------------|
 | -.3965632   -.0002388       4 |
 | -.3926637    .1616845       4 |
 | -.3358584    .2037638       4 |
 | -.5474986    .5839815       4 |
 |-------------------------------|
 |  .1766358     .701948       5 |
 |   .085008    .8024728       5 |
 +-------------------------------+

.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index