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 |
Mike <quangn@hawaii.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Generating a variable to indicate whether an array of variables is in increasing value |

Date |
Wed, 1 Jun 2011 17:52:31 -1000 |

We have a data set, that have 4 variables: x1, x2, x3, x4. Can you help generating a variable y whose value is constructed as follows: y = 1 if x1>x2>x3>x4 y = 2 if x2>x1>x3>x4 and so on. Sure, we can use something such as: gen y=. rep y =1 if x1>x2 & x2>x3 & x3>x4 However, there is missing value in some of the x variables. Can you suggest some efficient solution for this question? -- "My father gave me the greatest gift anyone could give another person, he believed in me." - Jim Valvano * * 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: Generating a variable to indicate whether an array of variables is in increasing value***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**st: set constraints for coefficients of independents in regression** - Next by Date:
**st: panel data xtmixed vs xtreg** - Previous by thread:
**st: set constraints for coefficients of independents in regression** - Next by thread:
**Re: st: Generating a variable to indicate whether an array of variables is in increasing value** - Index(es):