Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: cond(x,a,b,c) function


From   James Cui <james.cui@med.monash.edu.au>
To   statalist@hsphsun2.harvard.edu
Subject   st: cond(x,a,b,c) function
Date   Fri, 15 Apr 2005 12:32:38 +1000

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: James.Cui@med.monash.edu.au



begin:vcard
fn:James  Cui
n:Cui;James 
org:Monash University;Department of Epidemiology & Preventive Medicine
adr:;;Alfred Hospital, 89 Commericial Road;Melbourne;Victoria;3004;Australia
email;internet:james.cui@med.monash.edu.au
title:Senior Research Fellow
tel;work:+61 3 990 30570
tel;fax:+61 3 990 30556
tel;home:+61 3 9370 8098
x-mozilla-html:FALSE
version:2.1
end:vcard




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