Hi Paige, thanks for the reply! I have never heard about that function and that is really interesting. I am a little confused how to do this still. When I first expressed the question I don't think I represented my problem as well as I would have liked and I apologize for wasting your time. I thought that I could simplify the problem to figure it out, but it left me more confused. In my data there are actually two data sets. the first data set has responses to questions. In the example that I provided, the responses are the variables represented by a-e. In the second dataset, each row has a different model denoted by model in the example. Each model corresponds to a separate list of questions (ex. cat1 in dataset two may correspond to questions a, b, and c in dataset one). In my example I tried combining the steps. Using the method that you suggested, I was able to create fields Val1-Val8 in dataset2 that represent the questions that are needed for each category. So if I were to continue my example my data is actually better represented by the example below. My goal is to get the answers from data1 to data2 based on the corresponding model data data1;
input id mon year a b c d e;
datalines;
1 1 2009 1 2 3 4 5
2 1 2009 2 3 4 5 6 3 1 2009 3 4 5 6 7
;
run; data data2; input id mon year model $ val1 $ val2 $ val3 $ val4 $ val5 $; datalines; 1 1 2009 cat1 a c e 2 1 2009 cat2 b d e 3 1 2009 cat3 e ; run; What I need is to match up based on id and monthend and get a final dataset that would look like id mon year model val1 val2 val3 val4 val5 q1 q2 q3 q4 q5 1 1 2009 cat1 a c e 1 3 5 2 1 2009 cat2 b d e 3 5 6 3 1 2009 cat3 e 7 Thanks for the help, Tom
... View more