I think you want to use the -joinby- command. Here's an example I just
tried
Two text files, test1.txt and test2.txt are to be merged using -joinby-
test1.txt content:
Index,Measure
1,300
2,400
3,100
4,200
5,600
10,300
9,400
8,100
7,200
5,600
15,300
12,400
13,100
14,200
16,600
test2.txt content:
Measure,Weight
100,1.1
200,1.2
300,1.3
400,1.4
500,1.5
600,30
Note that Index has many more entries than Weight, which is, I think, the
case with the dataset you're working with. Also, test2.txt has Measures
that do not exist in test1.txt, and the records are ordered by Measure
value, whereas in test1.txt they are ordered by Index - so the structure of
the data is quite different. -joinby- doesn't appear to care.
First, convert test2.txt to a stata dataset, so that -joinby- can work with
it:
-insheet using test2.txt-
-save "test2.dta"-
Open the large dataset
-insheet using test1.txt-
Merge the datasets using -joinby-
-joinby using test2.dta-
You'll see your variable list expand from
Index
Measure
to
Index
Measure
Weight
and when you -browse- the dataset you will see
Index Measure Weight
3 100 1.1
8 100 1.1
13 100 1.1
7 200 1.2
4 200 1.2
14 200 1.2
10 300 1.3
1 300 1.3
15 300 1.3
12 400 1.4
2 400 1.4
9 400 1.4
5 600 30
16 600 30
5 600 30
Is this what you were looking for?
John Wallace
Research Associate
Affymetrix, Inc
-----Original Message-----
From: Rodrigo Brice�o [mailto:[email protected]]
yes, I thought that but the case is that I have repeated GRDs and then I
need to look for the specific GRD and assign their weight. We only have
approximately 500 GRDs and the database has 300,000 registers. I think that
I need a kind of logical formula to combine the two data sets.
-----Mensaje original-----
From: Jiang, Tao [mailto:[email protected]]
merge the two data sets.
-----Original Message-----
From: Rodrigo Brice�o [mailto:[email protected]]
Sent: Friday, December 06, 2002 1:47 PM
To: Statalist (E-mail)
Subject: st: One question
Hello friends!
I have a discharges database with more than 300,000 registers. I need to
assign a weight to each discharge (each patient) according to a list. How
can I do that?
patient GRD Weight
1 334
2 300
Thanks
Rodrigo Brice�o
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.423 / Virus Database: 238 - Release Date: 11/25/2002
*
* 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/