Roy,
Call the two datasets data1 and data2. Then,
. use data1
. sort id
. save data1, replace
. use data2
. sort id
. save data2, replace
. merge id using data1
scott
On Jun 2, 2007, at 5:41 PM, Roy,Suryadipta wrote:
Hi,
I am trying to join two datasets. The first one is of the form:
id code
1 a
2 b
3 c
4 d
The second is of the form:
id1 code1
3 c
4 d
I am trying to merge these two datasets such that the new dataset
is of the form:
id id1 code code1
1 3 a c
1 4 a d
2 3 b c
2 4 b d
3 3 c c
3 4 c d
4 3 d c
4 4 d d
Any help would be highly appreciated.
Thanks!!!
Suryadipta.
*
* 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/