Statalist


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

st: question on cond( )


From   "Visintainer, Paul" <[email protected]>
To   <[email protected]>
Subject   st: question on cond( )
Date   Thu, 28 Feb 2008 11:58:00 -0500

I'm not sure why the "condition" function is not coding z with 2 missing
values.  If I'm reading the functions command correctly, z should be
coded as missing:          

cond(a>2,"this","that","missing") = "missing" if a > .
cond(a>2,"this","that","missing") = "this" if a > 2 and a < .

Any ideas?

Thanks.

. gen z=cond(x>5,1,0,.)

. list

     +-------+
     | x   z |
     |-------|
  1. | 1   0 |
  2. | 2   0 |
  3. | 3   0 |
  4. | 4   0 |
  5. | 5   0 |
     |-------|
  6. | 6   1 |
  7. | 7   1 |
  8. | 8   1 |
  9. | .   1 |
 10. | .   1 |
     +-------+



______________________________________
Paul F. Visintainer, PhD


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