0 Replies Latest reply: Oct 20, 2017 1:52 PM by Michael Andrews RSS

    Need help looping through results in a sub set

    Michael Andrews

      We report on exams. We have a report where we show data on each answer selected for questions. Think like here's question one, there were four answers, here's the percent of people that selected a, here's the percent of people that selected b, etc. (I've attached a screen shot to help illustrate).


      The issue I'm having is I need a way to loop through all answers given on an exam, per answer, to correlate the people who selected that answer, vs what their exam score was.


      So pseudo code would look something like this. Let's assume I'm on exam 1, question 1, answer option A

      for(every answer on question 1)


           if they selected A we add 1 and their score to the matrix

           else we add 0 and their score to the matrix



      But then do that for all answers, so B, C, etc.


      The end result would look something like corr([1, 38], [0, 45], [1, 32])


      Where 1 would be whenever they selected that answer that I'm currently on, and the second number is that individual's exam score on that exam. I'm just not clear on what the syntax would be to say I'm on answer A, loop through all responses to this question, and correlate the exam score with a 1 or 0, if they selected A.