Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS? |

Date |
Tue, 21 Sep 2010 12:52:48 +0200 |

<> Won`t the typing of the pipe | symbol _and_ the variable name for each comparison get tedious for more than three arguments? -inlist()- requires only an additional comma... HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Dienstag, 21. September 2010 12:49 To: 'statalist@hsphsun2.harvard.edu' Subject: RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS? I agree with Martin Weiss. -inlist()- in Stata appears to be the equivalent of IN in SAS. I also agree with Anisa Shyti, correcting a typo: cond(x == 3 | x == 4 | x == 5, 1, 0) is another way to solve the problem, but better for a short list. Indeed x == 3 | x == 4 | x == 5 is yet another way to do it, as the expression just above evaluates to 1 or 0 any way. Nick n.j.cox@durham.ac.uk Anisa Shyti let me be more precise: in the condition should be cond(x=3 | x=4 | x=5, 1, 0) - it depend on the condition one needs to set - I was giving a handy example. The cond(.) is pretty flexible. * * 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/ * * 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/

**Follow-Ups**:**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?***From:*Anisa Shyti <anisa.shyti@gmail.com>

**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?** - Next by Date:
**st: RE: St: Panel data imputation** - Previous by thread:
**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?** - Next by thread:
**RE: st: RE: RE: RE: Comparison operator, similar to "IN" in SAS?** - Index(es):