Statalist


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

st: RE: "cond" command


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: "cond" command
Date   Thu, 11 Sep 2008 14:59:56 +0100

-cond()- is a function, not a command. 

-cond()- has either three or four arguments. The outer -cond()- in your example is illegal because it has two. 

gen col = cond(pension == 1,        
               cond(jub == 1, 1, 2))

The first argument in the outer -cond()- is 

	pension == 1 

and the second is 

	cond(jub == 1, 1, 2) 

but there is no third argument. 

The inner -cond()- is legal. 

Your definitions are not clear to me, so I can not say what is the correct syntax. It may be 

cond(pension == 1 & jub == 1, 1, 2) 

Nick 
n.j.cox@durham.ac.uk 

Leonor Saravia

I'm trying to tabulate some information, but Im having problems doing
it, so Id appreciate if you could see it and tell me what's what Im
doing wrong.

What I did, was:

gen col = cond(pension == 1,               ///
               cond(jub == 1, 1, 2))

label define col  1 "pension, jub"               ///
                        2 "pension, Sobrevivencia"     ///
             	
label value col col

Where the variables have this information: pension = (0,1, 2)
                                                             jub = (0,1)

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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