## Combining variables using specific cases

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

spssquestions
Posts: 2
Joined: Sun Feb 01, 2015 10:17 pm

### Combining variables using specific cases

I am working with a data set derived from an experimental morphing task where a neutral face gradually changed into an emotional face over 20 different slides. I am interested in how quickly participants can identify the correct emotion.

Each participant has multiple opportunities to guess the emotion, even after they've correctly guessed the emotion. Each emotion is represented as an individual variable, and there are at least 2 trials for each emotion. I also have a second variable that indicates whether the child guessed the emotion correctly (1 = correct, 0 = incorrect).

I need to create a new variable that is the average of their first correct guess/slide# for the two trials. How can I create this variable?
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Combining variables using specific cases

That depends on how your data is organized now. E.g., is there one line per participant? Or each particpant is in the data multiple times? Etc.

Please provide an example of how your data look now, and what you want to achieve.

p.s.
I have used this paradigm a lot, I'd be quite interested in your results / what you are examening!
spssquestions
Posts: 2
Joined: Sun Feb 01, 2015 10:17 pm

### Re: Combining variables using specific cases

Hello,

Thank you for your response! I’ve attached a sample of a data set for clarity. Children in our study watch a face change from a neutral expression to one of four emotions over 20 slides. We need to know how quickly each child correctly identifies the emotion (happy, sad, anger, or fear). There are two trials for each emotion. The data file contains a line for each slide presented (20 for each trial). During each trial, participants have multiple opportunities to identify the correct emotion. However, we need to know the first time they correctly identify the emotion for each of the two trials.

In our data set, we are working with 3 variables. One variable identifies the target emotion (ListNameTrial). One variable identifies the slide numbers (slidenumberSubTrial). We have created a third variable indicating whether the child correctly identified the emotion (CorrectEmotionResponse; 1 = correct, 0 = incorrect).

We are interested in averaging the first time the child identified the correct emotion across the 2 trials for that emotion. Any assistance on how we would create this would be great!

Thank you!
You do not have the required permissions to view the files attached to this post.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Combining variables using specific cases

It is a bit of a puzzle, but you can manage if you combine aggregate functions with if-statements.

You can use the "first" command within aggregate (break on ID and listnametrial) to get an indication of when the first one occurs, then you can use if to get a new variable holding the value of the slidenumber corresponding to that slide.

If you can't figure it out, I'd be happy to work with you on a paper (I know this is very cheeky, I just love this paradigm, so I thought: nothing ventured nothing gained).

### Who is online

Users browsing this forum: No registered users and 1 guest