Bookmark and Share

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]

st: comparing conditions


From   A Loumiotis <antonis.loumiotis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: comparing conditions
Date   Tue, 14 Dec 2010 13:45:05 +0200

Suppose I have this dataset:
clear
input str5 var_name str40 var_filter
v1
v2
v3    v2==2 | v2==1
v4    v3==1
v5    v1==1
v6    v2==2 | v2==1
v7
v8    v7>0
v9    v7>1
v10  v2==2
end

I would like to generate another string variable, call it var_reg,
that for each var_name it lists all the other var_name that have the
same filter or looser filter.  This is how I want var_reg to look
like:

var_name    var_reg
v1    v2 v7
v2    v1 v7
v3    v1 v2 v6 v7
v4    v1 v2 v7
v5    v1 v2 v7
v6    v1 v2 v3 v7
v7    v1 v2
v8    v1 v2 v7
v9    v1 v2 v7 v8
v10  v1 v2 v3 v6 v7

Is there anyway to do this automatically?  I guess my main question is
how to check whether one condition is looser than another condition?

Thanks,
Antonis Loumiotis
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index