The logical expression -rep78==1- is never missing, if rep78 is missing then the expression is false (0) and -cond()- returns 0.
Hope this helps
David
-----Original Message-----
From: James Cui [mailto:[email protected]]
Sent: 15 April 2005 03:33
To: [email protected]
Subject: st: cond(x,a,b,c) function
Dear all:
When I use the cond(x,a,b,c) function, I could not generate the value c
when x is missing. For example:
sysuse auto, clear
tab rep78, mi
gen a=cond(rep78==1, 1, 0, .)
tab a, mi
It gives
a Freq. Percent Cum.
0 72 97.30 97.30
1 2 2.70 100.00
Total 74 100.00
There should be 5 missing values for variable a according to the manual.
Thanks for your input.
James.
--
James Cui, PhD MMed BSc (Stats)
Senior Research Fellow
Department of Epidemiology & Preventive Medicine
Monash University
Alfred Hospital, 89 Commercial Road
Melbourne, Victoria 3004
Australia
Tel: 990 30570
Fax: 990 30556
Email: [email protected]
*
* 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/