Tuesday, February 28, 2006

st: RE: numlist abbreviations interpreted differently in egenmore's eqany S8?

> -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Marino, Jennifer > Sent: Tuesday, February 28, 2006 8:14 PM > To: statalist@hsphsun2.harvard.edu > Subject: st: numlist abbreviations interpreted differently in egenmore's > eqany S8? > > I'm working in Stata 8. > > Four ways of generating a numlist of whole positive integers are > supposed to be identical, but I'm finding they generate different > results with the same dataset in Stata 8.2. > > egen nurshealthtech=eqany(jobnum*),v(088 089 095 097 098 099 103/106 134 > 206/208 235 446 447) > egen nurshealthtech2=eqany(jobnum*),v(088 089 095 097 098 099 103:106 > 134 206:208 235 446 447) > egen nurshealthtech3=eqany(jobnum*),v(088 089 095 097 098 099 103 to 106 > 134 206 to 208 235 446 447) > egen nurshealthtech4=eqany(jobnum*),v(088 089 095 097 098 099 103(1)106 > 134 206(1)208 235 446 447) > > . count if nurshealthtech==1 > 173 > > . count if nurshealthtech2==1 > 156 > > . count if nurshealthtech3==1 > 156 > > . count if nurshealthtech4==1 > 173 > > Aren't these supposed to be the same? >

No. For the ":" and "to" syntax, the preceding number specify the interval used in constructing the number list.

For example:

10 15 to 25 == 10, 15, 20, 25

which is different than

10 15/25 == 10 15, 16, 17,..

-help numlist- has many more examples.

Scott

* * 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?