Syntax for Aggregate

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

manny1490
Posts: 3
Joined: Thu Feb 23, 2012 10:38 pm

Syntax for Aggregate

Postby manny1490 » Fri Mar 30, 2012 3:55 am

Hi There ,

This might be a relatively easy question but I dont understand how to do it. I tried using select if for this but it didnt work.

Here is the problem:

I have EIGHT columns of values which are set up in the following way
group 1 then Group 1 correct thhen group 2 then Group 2 correct then group 3 then Group 3 correct then group 4 then group 4 correct .
Now the columns labeled group 1, 2 3 and 4 contain numeric values (a bout 5-6 numeric values in each column). The columns adjacent to these columns as shown above are the ones that have a response of 1 or 2 for correct. That means if the numeric value corresponding to Group 1 for example has sa correct value then the column adjacent to it (i.e. group 1 correct) would have a value of 1.

I want to aggregate the Group 1 group 2 group 3 and group 4 values into 4 different columns labeled group 1 mean group 2 mean group 3 mean and group 4 mean. Now I know how to do this on spss and how I can use aggregate function to get the mean. However, what I also need to do is tell spss to aggregate the means only whenthe responses are Correct (=1) for the numeric values. How do I go about doing this on the syntax? I tried the select if command to specify to use the correct responses only but it apparently didnt work unless I entered it wrong somehow. So please advice me on what can be done so I can create my syntax asap.

Thanks for all the help
Manny
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Syntax for Aggregate

Postby GerineL » Fri Mar 30, 2012 8:10 am

try this. In this example, I assume that "group1" contains the values for group 1 and that "correct1" has a 1 if correct.
aggregate
/outfile=* mode=addvariables
/break=correct1
/T_g1_mean=mean(group1).

if (correct1 = 1) temp = t_g1_mean.
execute.

aggregate
/outfile=* mode = addvaraibles
/break=
/meangroup1 = min(temp).

delete variables temp t_g1_mean.

Who is online

Users browsing this forum: No registered users and 2 guests

cron