I am trying to gen a variable or variables that say VAR1 has elements in commons with other 2 variables (VAR2 and VAR3), VAR2 has element in common with only one variable (VAR4), VAR 3 has elements in common with only VAR1 and VAR4 has elements in common with only one variable VAR2. I have to do this by place.

Is there any way to do this in Stata?
Thanks.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str51 place float(VAR1            VAR2                    VAR3                    VAR4)
"SAN LEANDRO"      1996 . . .
"SAN LEANDRO"      1997 . . .
"SAN LEANDRO"      1998 . . .
"SAN LEANDRO"      1999 . . .
"SAN LEANDRO"           . . . .                                 1994
"SAN LEANDRO"            . . . .                                1995
"SAN LEANDRO"             . . . .                               1996
"SAN LEANDRO""             . . . .                              1997
"SAN LEANDRO"" . . . .                   1998
"SAN LEANDRO""  . . . .                  1999
"SAN LEANDRO""   . . . .                  2000
"SAN LEANDRO""       . . . .              2001     
"SAN LEANDRO""           . . . .                                                          2000  
"SAN LEANDRO""            . . . .                                                         2001
"SAN LEANDRO""             . . . .                                                        2002
"SAN LEANDRO""              . . . .                                                       2003 
end