s-news
[Top] [All Lists]

merging two data sets

To: s-news@lists.biostat.wustl.edu
Subject: merging two data sets
From: "Boylan, Richard" <rboylan@bus.olemiss.edu>
Date: Thu, 22 Feb 2001 13:49:18 -0600
I need to combine two data sets and would like some suggestions on how to go
about doing it.
I understand that you may not want to take the time to read through the
problem, but if you don't
mind just skimming through it to point me towards the general direction
(e.g, some people have told
me to use SAS instead of Splus for this type of problem).

Thanks. Richard


What I want to get is a data set in which a row looks as follows:

location_i    year_j   measurement1_{ij}  measurement2_{ij}

where measurement1_{ij} and measurement2_{ij} are two rows of measurements.

In the first data set, a row looks like this:

location_i  beginning_year  end_year  measurement1_i

In the second data set, a row looks like this

location_1  measurement2_{i1} measurement2_{i2} measurement2_{i3} ..

Here is an example to make things more understandable.

First data set has

AL 1950 1952 1 2 3
AL 1953 1954 4 5 6
AK 1950 1954 

Second data set has

       1950_obs1  1951_obs1  1952_obs1 1952_obs1 1952_obs1  1950_obs2
1951_obs2 ..
AL        7               8                  9             10            11
12              13
AK      14             15                16              17            18
19               20

The data I want would be

AL 1950 1 2 3 7 12
AL 1951 1 2 3 8 13
AL 1952 1 2 3 9 ...
AL 1953 4 5 6 ...
AK 1950 ....
AK 1951 ...
...

                                        






<Prev in Thread] Current Thread [Next in Thread>