Creating a table of means

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

Creating a table of means

Smith, Barry

I would like to produce a table of means of related variables. I have about 50 sets of related variables in each case. For example I have a set of variables v1, v2 ….v50, another set of variables h1, h2, . . . h50 and a third set of variables d1, d2, . . . d50.  This mean there are 150 variables of importance to me in each case. Variable v1 is related to h1 and d1. v2 is related to h2 and d2 and so forth. I want to produce a table showing the mean of each variable. The table would have three columns for v, d, and h type variable. There would be 50 rows since there are 50 varieties of v variables (v1, 2, etc), 50 varieties of d variable and 50 varieties of h variables. I have the CTABLES module and cannot seem to get what I want. I would greatly appreciate help on how to do this.

 

With Appreciation,

 

Barry

 

===================== 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: Creating a table of means

David Marso
Administrator
Restructure the data prior to CTABLES!!!
/* Data simulation */.
MATRIX.
SAVE UNIFORM(1000,150)/OUTFILE * / VARIABLES v01 TO v50 h01 TO h50 d01 TO d50.
END MATRIX.

/* Code */.
VARSTOCASES
    MAKE v FROM v01 TO v50
  / MAKE h FROM h01 TO h50
  / MAKE d FROM d01 TO d50
  / INDEX=var(50).
VARSTOCASES
    MAKE vhd FROM v h d
  / INDEX=type(vhd).

VARIABLE TYPE vhd (SCALE)  type var (NOMINAL).
/* Fix up labels and such */.
CTABLES / TABLE vhd>var BY type.

Smith, Barry wrote
I would like to produce a table of means of related variables. I have about 50 sets of related variables in each case. For example I have a set of variables v1, v2 ....v50, another set of variables h1, h2, . . . h50 and a third set of variables d1, d2, . . . d50.  This mean there are 150 variables of importance to me in each case. Variable v1 is related to h1 and d1. v2 is related to h2 and d2 and so forth. I want to produce a table showing the mean of each variable. The table would have three columns for v, d, and h type variable. There would be 50 rows since there are 50 varieties of v variables (v1, 2, etc), 50 varieties of d variable and 50 varieties of h variables. I have the CTABLES module and cannot seem to get what I want. I would greatly appreciate help on how to do this.

With Appreciation,

Barry


=====================
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating a table of means

Jon K Peck
In reply to this post by Smith, Barry
Something like this would do it.

DATASET DECLARE aggr.
AGGREGATE
  /OUTFILE='aggr'
  /v1 to v50=MEAN(v1 to v50)
   /h1 to h50=MEAN(h1 to h50)
  /d1 to d50=MEAN(d1 to d50).

VARSTOCASES
  /MAKE v FROM v1 TO v50
  /MAKE h FROM h1 TO h50
  /MAKE d FROM d1 TO d50.

compute ID=$casenum.
variable level ID (nominal).
ctables /table ID>(v+h+d)[mean].

DATASET ACTIVATE aggr.
CTABLES
  /VLABELS VARIABLES=ID DISPLAY=NONE
  /TABLE ID BY (v  + h + d) [MEAN]
  /SLABELS VISIBLE=NO.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        "Smith, Barry" <[hidden email]>
To:        [hidden email],
Date:        06/27/2014 02:24 PM
Subject:        [SPSSX-L] Creating a table of means
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I would like to produce a table of means of related variables. I have about 50 sets of related variables in each case. For example I have a set of variables v1, v2 ….v50, another set of variables h1, h2, . . . h50 and a third set of variables d1, d2, . . . d50.  This mean there are 150 variables of importance to me in each case. Variable v1 is related to h1 and d1. v2 is related to h2 and d2 and so forth. I want to produce a table showing the mean of each variable. The table would have three columns for v, d, and h type variable. There would be 50 rows since there are 50 varieties of v variables (v1, 2, etc), 50 varieties of d variable and 50 varieties of h variables. I have the CTABLES module and cannot seem to get what I want. I would greatly appreciate help on how to do this.
 
With Appreciation,
 
Barry
 

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (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
|

FW: Creating a table of means

Smith, Barry
In reply to this post by David Marso
Thanks to David and Jon for quick responses. I think I will be able to do what I want with a combination of what the two of you suggested. In the process, I have learned a technique that I have previously shied away from. That is a definite bonus for me.
Thanks again.

Barry


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: Friday, June 27, 2014 4:41 PM
To: [hidden email]
Subject: Re: Creating a table of means

Restructure the data prior to CTABLES!!!
/* Data simulation */.
MATRIX.
SAVE UNIFORM(1000,150)/OUTFILE * / VARIABLES v01 TO v50 h01 TO h50 d01 TO d50.
END MATRIX.

/* Code */.
VARSTOCASES
    MAKE v FROM v01 TO v50
  / MAKE h FROM h01 TO h50
  / MAKE d FROM d01 TO d50
  / INDEX=var(50).
VARSTOCASES
    MAKE vhd FROM v h d
  / INDEX=type(vhd).

VARIABLE TYPE vhd (SCALE)  type var (NOMINAL).
/* Fix up labels and such */.
CTABLES / TABLE vhd>var BY type.

From Jon Peck:
Something like this would do it.

DATASET DECLARE aggr.
AGGREGATE
  /OUTFILE='aggr'
  /v1 to v50=MEAN(v1 to v50)
   /h1 to h50=MEAN(h1 to h50)
  /d1 to d50=MEAN(d1 to d50).

VARSTOCASES
  /MAKE v FROM v1 TO v50
  /MAKE h FROM h1 TO h50
  /MAKE d FROM d1 TO d50.

compute ID=$casenum.
variable level ID (nominal).
ctables /table ID>(v+h+d)[mean].

DATASET ACTIVATE aggr.
CTABLES
  /VLABELS VARIABLES=ID DISPLAY=NONE
  /TABLE ID BY (v  + h + d) [MEAN]
  /SLABELS VISIBLE=NO.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621
Smith, Barry wrote

> I would like to produce a table of means of related variables. I have
> about 50 sets of related variables in each case. For example I have a
> set of variables v1, v2 ....v50, another set of variables h1, h2, . .
> . h50 and a third set of variables d1, d2, . . . d50.  This mean there
> are 150 variables of importance to me in each case. Variable v1 is
> related to h1 and d1. v2 is related to h2 and d2 and so forth. I want
> to produce a table showing the mean of each variable. The table would
> have three columns for v, d, and h type variable. There would be 50
> rows since there are 50 varieties of v variables (v1, 2, etc), 50
> varieties of d variable and 50 varieties of h variables. I have the
> CTABLES module and cannot seem to get what I want. I would greatly appreciate help on how to do this.
>
> With Appreciation,
>
> Barry
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Creating-a-table-of-means-tp5726606p5726607.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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