Devendra,
You can easily solve this by using -merge-. Assuming that you save
your data as "myData.dta", you can solve this as follows:
use myData , clear
ren var1 Link
sort Link
keep Link
duplicates drop
gen IsHere = 1
save tmpList, replace
use myData , clear
ren var2 Link
sort Link
merge Link using tmpList, uniqusing nokeep
drop _merge
ren Link var2
After running these commands you can -list- your data to obtain:
+----------------------+
| var1 var2 IsHere |
|----------------------|
1. | M101 F100 1 |
2. | F120 F130 . |
3. | F145 M101 1 |
4. | F100 M101 1 |
+----------------------+
For all values of var1 which are also contained in var2 variable
IsHere equals 1.
I hope this helps.
Best,
Ingo
On 4/23/07, Devendra Amre <[email protected]> wrote:
Sorry the earlier message was incomplete..here the complete question..
Hi everyone,
Is there a STATA command similar to VLOOKUP that is available in EXCEL?
For example, I have a list of IDs as 2 variables. I wish to check if
any ID listed in var1 are present in var2..here is an example:
var1 var2
M101 F100
F100 M101
F120 F130
F145 M101
IDs M101 and F100 are common..is there some way of tagging these IDs?
Thanks in advance.
Devendra
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/