Statalist The Stata Listserver

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

st: RE: minimum of "all other variables"

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: minimum of "all other variables"
Date   Tue, 17 Oct 2006 08:59:41 +0100

unab myvars : ab-AB
foreach v of local myvars { 
	local others : list myvars - v 
	egen max_`v' = rowmax(`others') 

[email protected] 

Steve Vaisey
> I have been wrestling with a problem for a while, and I've finally 
> decided to bring it to you for what will probably be an embarassingly 
> quick solution. Here's the problem. Thanks to Nick, I have a program 
> (-myboolean-) that turns fuzzy sets into multiset fuzzy 
> intersections. 
> So, for example, with fuzzy sets A and B, running -myboolean A B- 
> yields four new variables: ab Ab aB AB (where lower = absence 
> [1-set], 
> upper = presence [set], and -- for example -- AB = min(A,B)). Enough 
> background I hope.
> What I'd like to do now is to create new variables that contain the 
> maximum value of all OTHER configurations for each configuration 
> produced by -myboolean-. Manually, this is easy to do: otherAB = 
> max(Ab,aB,ab). But with 32 or 64 configuration variables, 
> this is very 
> time consuming. Is there a way to automate this so that:
>      foreach var of varlist ab - AB {
>      gen other`var' = max(***all other vars in varlist but `var'***)
>      }
> One final note: in the crisp set case (where set membership is always 
> 0/1) other`var' would always = 1-`var'. But this is not true in the 
> fuzzy case. Hence the difficulty.

*   For searches and help try:

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