Statalist The Stata Listserver


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

RE: st: RE: simple question: generating variables using the if / or command


From   "Gauri Khanna" <[email protected]>
To   [email protected]
Subject   RE: st: RE: simple question: generating variables using the if / or command
Date   Thu, 27 Apr 2006 16:28:09 +0000

And thank you JOhn.

Gauri

From: "John Novak" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: simple question: generating variables using the if / or command
Date: Thu, 27 Apr 2006 07:19:46 -0700

not to mention the use of the logical == instead of the assignment
operator = (double equal sign vs single equal sign)


>>> [email protected] 04/27/06 7:13 AM >>>
Sounds like you want | (or) instead of & (and)...

gen newvariable = var1 + var2 + var3 if dum1==1|dum2==1|dum3==1

David

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Gauri
Khanna
Sent: 27 April 2006 15:03
To: [email protected]
Subject: st: simple question: generating variables using the if / or
command

Dear Stata list,

I have a seemingly simple problem that I can't seem to figure out.

1) I would like to generate a new variable :

generate newvariable=var1+var2+var3 if dum1=1 and or dum2=1 and or
dum3=1

In essence I want to sum across var2, var3 and var4 for a case where
either of the three dummies are equal to 1.

2) If instead I did the following....

generate
newvariable=var1+var2+vhttp://by112fd.bay112.hotmail.msn.com/cgi-bin/com
pose?&curmbox=00000000%2d0000%2d0000%2d0000%2d000000000001&a=8e97f2d6d33
d18578baf68a0a3ed45387544cbaa5b179c9e4483d1f9e6d16955#
Sendar3 if dum1=1 & dum2=1 & dum3=1

.... I would only capture values for var1, var2 and var3 if ALL the
three dummies simultaneously are 1. is this correct? If so I do not
want this.

Thank you.

Regards,

Gauri

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

*
* 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/
*
* 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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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