Statalist


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

st: RE: "cond" command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
[email protected] 

Leonor Saravia

I'm trying to tabulate some information, but I�m having problems doing
it, so I�d appreciate if you could see it and tell me what's what I�m
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index