Statalist


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

st: RE: Compare values from two datasets


From   "Kavetsos, Georgios" <[email protected]>
To   <[email protected]>
Subject   st: RE: Compare values from two datasets
Date   Wed, 16 Jan 2008 18:53:40 -0000

Hi Gao,
 
Generate a new variable, say x,  using the following:
 
generate x=1 if A==B
 
For the case the two variables are equal, the 1 will appear, otherwise a missing value (indicated by .) will appear.
 
Best,
George

________________________________

From: [email protected] on behalf of Gao Liu
Sent: Wed 16/01/2008 18:51
To: [email protected]
Subject: st: Compare values from two datasets



Hi, Statalist:

I have two datasets A and B. I need to create a dummy variable in A to
tell me whether the value of a string variable (say lic_no ) in A
matches any value in the variable of psycho_lic_no in B. Simply put, I
want to see whether the value for each obs. in A is on a list. But as
the list (the value of psycho_lic_no in B) is so long (over 10000), it
is inconvenient to copy and paste all the values, and compare them
with the lic_no one by one.

Any good way to make the job easier? Thank you.

Best

Gao
*
*   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/


<<winmail.dat>>




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