Hi Tom, I do want to keep all of Z. This is the essence of my problem. From the example in the first post I have two Bear observations, a sum for a bear hide if you want. What I want is the questionaire for each of the individual animal observation (e.g. for each bear hide price) - and as the hide price is not a common variable I am finding this hard to achieve. I am sorry if my explanation of the problem was bad. I'll use another example, more closely related to my problem below: I have 2 datasets, one (I) with data on customers, and another (A) with a questionaire about our services. These two may be linked through a common variable, customer number. Each question on the questionaire is represented with one observation (one line in SAS), hence each individual customer questionaire may have multiple observations in dataset A. Similarly the data may have one or more observation for each customer number in the customer data set (B)may have one or more observations for each customer number in the second data set B. Luckily this is no problem using the Merge statement if the dataset is properly sorted. However, I have one other, uncommon variable, in one of the datasets (II) which is importaint is not lost. As for now my problem using the merge statement is that the data are not properly merged together as SAS just jumps to the next observation with the same customer ID (in the example below; Customer Name) SET A x y r s Obs#1 Question 1 Jake Obs#1 Jake 100 Obs#2 Question 2 Jake Obs#1 Jake 250 Obs#3 Question 3 Jake yielding obs # 1 question 1 Jake 100 obs # 2 question 2 Jake 250 Obs# 3 question 3 Jake 250 Wheras I want to have Obs#1 Question 1 Jake 100 Obs#2 Question 2 Jake 100 Obs#3 Question 3 Jake 100 Obs#4 Question 1 Jake 250 Obs#5 Question 2 Jake 250 Obs#6 Question 3 Jake 250 ------ Arthur's procedure above did partially acomplish this, however when I control for #observations by filtering away the uncommon variables, leaving me with only the common variables and using NODUPLICATES to sort out repeated customer# the resulting number of observations deviates severly (50% lost!) from what "I started" out with... E.g. something goes severly wrong using this procedure. (When I use the MERGE BY statement I am able to retrieve the same number of customer# as I started out with.)
... View more