How to add a line to a table with a not weighted sum

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add a line to a table with a not weighted sum

fjmenendez
Hi,

I have been asked about how to get a simple sum of mean (not weighted), such as the one in bold font. I don´t fully understand the purpose of that sum from a data analysis point of view. Despite that, I d´appreciate help to do it.


  VARX1
Mean1
VARX2
Mean2
VARX3
(categorical)
aaa486000
bbb
407000
ccc3010000
ddd4030000
 Sum of means (simple, not weighted)15853000


Thanks in advance :)
Jorge.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to add a line to a table with a not weighted sum

Jignesh Sutar
You can use custom tables (CTABLES command), provided you have that add-on module, to generate the weighted and unweighted means. Since version 18 there has been an introduction of PCOMPUTE within CTABLE to be able to post compute additional statistics from initial aggregated statistics i.e. in your cases taking the sum of means of VARX1 across all categories of VARX3.


Here is an example using the employee data shipped with SPSS:

ctables
 /pcompute &SumMean=expr([1]+[2]+[3]) /pproperties &SumMean label="Sum of means (simple, not weighted)"
  /table jobcat[c] by (salbegin+salary)[s] [mean 'Weighted mean' umean 'Unweighted mean']
  /categories variables=jobcat [1,2,3,othernm, &SumMean]
  /slabels position=row.

This is far as I can get as close to your desired output. You will notice that there is a row for both weighted and unweighted for each category, when only weighted is desired for valid categories and unweighted for the sum. There is no direct way of changing this behaviour in CTABLE (would be good if it was possible) but you can do so using extension command that modify output tables. Or alternatively if you are exporting to excel anyway you could delete these redundant rows using a VBA macro or if it is just a one off then delete manually.

Hope that helps,
Jignesh

On 15 November 2014 22:52, Florentino Jorge Menendez <[hidden email]> wrote:
Hi,

I have been asked about how to get a simple sum of mean (not weighted), such as the one in bold font. I don´t fully understand the purpose of that sum from a data analysis point of view. Despite that, I d´appreciate help to do it.


  VARX1
Mean1
VARX2
Mean2
VARX3
(categorical)
aaa486000
bbb
407000
ccc3010000
ddd4030000
 Sum of means (simple, not weighted)15853000


Thanks in advance :)
Jorge.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to add a line to a table with a not weighted sum

Rich Ulrich
In reply to this post by fjmenendez
You do want to get that sort of mean in a report of (say) sales for
different stores.  The format that you suggest is one sort of default
for the Report Generator.

--
Rich Ulrich


Date: Sat, 15 Nov 2014 20:52:29 -0200
From: [hidden email]
Subject: How to add a line to a table with a not weighted sum
To: [hidden email]

Hi,

I have been asked about how to get a simple sum of mean (not weighted), such as the one in bold font. I don´t fully understand the purpose of that sum from a data analysis point of view. Despite that, I d´appreciate help to do it.


  VARX1
Mean1
VARX2
Mean2
VARX3
(categorical)
aaa486000
bbb
407000
ccc3010000
ddd4030000
 Sum of means (simple, not weighted)15853000


Thanks in advance :)
Jorge.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to add a line to a table with a not weighted sum

David Marso
Administrator
In reply to this post by fjmenendez
It is trivial to calculate these using AGGREGATE!
fjmenendez wrote
Hi,

I have been asked about how to get a simple sum of mean (not weighted),
such as the one in bold font. I don´t fully understand the purpose of that
sum from a data analysis point of view. Despite that, I d´appreciate help
to do it.


  VARX1
Mean1
VARX2
Mean2VARX3
(categorical)aaa486000bbb
407000ccc3010000ddd4030000 *Sum of means (simple, not weighted)**158**53000*

Thanks in advance :)
Jorge.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"