Averaging and Computing Variables Based on Conditions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Averaging and Computing Variables Based on Conditions

Zachrey Santangelo
Hi all,

I have a dataset that looks something like this...

Code     q1      q2     ReadingScore

12345    1        0           521
12345    1        1           530
5421      1        1           651
5421      0        0           402

My goal is to average the ReadingScore based on the questions and Code.  So I want all of the people who answered 1 (Yes) from Code 12345 to have their ReadingScores averaged together and created into a new variable.  I would also like to have all of the people who answered No (0) from 5421 to have their ReadingScore's averaged together and have that created into a new variable.   Etc...

Is this possible?  I would appreciate any help...or just putting me down the right path.