## Net Descriptive Statistics for Multiple Variables

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

DrewForbes
Posts: 2
Joined: Tue Jul 21, 2015 4:29 pm

### Net Descriptive Statistics for Multiple Variables

Hi there, this forum has been a great guide over the years as I've crept around...now I have a question of my own.

Goal: I'm trying to write the syntax to get the net descriptive statistics for multiple variables.

Problem: Much like what you can achieve by highlighting multiple rows and columns in Microsoft Excel to get mean/min/max/stddev/variance, I want to get the total descriptive statistics for each MoveDistance variable listed below. Essentially, I would like to treat each MoveDistance Variable as if they were one column (For example below Min =0.5, max=89). What I am not trying to accomplish is to compute the grand mean for each ID as a new score.

Two things complicate writing syntax for this further: First, is my need to use If statetments, as some moves are eligible and others are ineligible (Eligible=1); Second is my need to disaggregate the descriptive statistics by Recruitment_Site. My syntax included below, accomplishes this but fails to give me the net MoveDistance means, standard deviation, min, max, and so on.

SPSS Version: 19

Dataset:

ID, Recruitment_Site, MoveDistance1(km), MoveDistance2(km), MoveDistance3(km), Move1_Eligibility, Move2_Eligibility, Move3_Eligibility.

101, Winnipeg, 89, 3, 7, 1, 1, 1,
102, Winnipeg, 17, 3, 0.5, 1, 1, 1,
103, Toronto, 22, 3, 6, 1, 1, 1,
104, Vanouver, 17, 5, 1, 1, 1, 0,
105, Montreal, 23, 3, 1, 1, 1, 0,
106, Montreal, 25, 4, 13, 1, 0, 0,
107, Toronto, 20, 3, 30, 1, 0, 0,
108, Toronto, 15, 4, 12, 1, 1, 1,
109, Halifax, 18, 3, 11, 1, 1, 0,
110, Winnipeg, 26, 3, 8, 1, 1, 1,

Syntax attempts thus far:

Temporary.
SELECT IF Move1_Eligibility = 1 OR Move2_Eligibility = 1 OR Move3_Eligibility = 1.
means MoveDistance1(km) MoveDistance2(km) MoveDistance3(km) by Recruitment_Site
/cells count min max mean median stddev seskew SPCT.
Execute.

I've been digging for answers for a few days now and cannot find any solutions on my own. Any help you could offer would be greatly appreciated.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

### Re: Net Descriptive Statistics for Multiple Variables

What I think you need is the aggregate function, you can use a break on your "selection" variable.
Is that what you are looking for?
DrewForbes
Posts: 2
Joined: Tue Jul 21, 2015 4:29 pm

### Re: Net Descriptive Statistics for Multiple Variables

Thanks GerineL for the quick response.

Unfortunately, I read up on and played with the aggregate command today and do not think it's quite what I'm looking for. The aggregate command doesn't allow you to collapse multiple variables into one mean, max, min, or standard deviation.

Following the previous example, syntax like

AGGREGATE
/BREAK=ID
/Mean1 to Mean3=MEAN(MoveDistance1 to MoveDistance3).

Gives me this:
Capture.PNG
When what I'm really looking for is just a mean of 13.18333333 (The Mean of MoveDistance1, MoveDistance2, and MoveDistance3 ignoring those Move_Eligibility Categories)

The aggregate command would work if only I could write the syntax like:

AGGREGATE
/BREAK=ID
/Mean=MEAN(MoveDistance1 to MoveDistance3).

However, this gives you the following error "The number of existing variables does not match the number of new variables in a new variable definition on the AGGREGATE command. "
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: Net Descriptive Statistics for Multiple Variables

It is not yet entirely clear to me what you want.

Do you want the mean of distance1 to distance 3 only for cases for whom eligable is 1?
So a mean per case? or an overall mean?

### Who is online

Users browsing this forum: No registered users and 2 guests