changing report table format in "MEANS"

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

changing report table format in "MEANS"

Jinkuk Hong
Hi all,
(there should be an easy solution, but I couldn't find one yet...)
I'm running "MEANS" to descriptively compare outcome variables among three groups.
By default, the "report" table presents the result in the format: Group
/Statistics in THE ROW, and Variables in the COLUMN.
Is there a way to change the default setting of the pivot tray so that the
"report" table would have a format of "Variable/Group in the ROW, and
Statistics in the COLUMN"?
I need this type of format for my weekly report (the tables are exported to a
Word document for a report) and with current format I have to change manually
each table using pivoting trays (with more than 50 outcome variables, it's lot
of tables to edit manually....).
Any suggestion or advice would be greatly appreciated.

Best,
Jin

--

=====================
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: changing report table format in "MEANS"

Jon K Peck
You can't change the default orientation.  The typical way this would be done is with an autoscript written either in Basic or Python.  However, the extension command SPSSINC MODIFY TABLES can pivot a table for you, so you could include this in your syntax to avoid the manual work.

I can provide more details if you want to go this route.  The extension command requires the appropriate Python programmability plugin.  Both are downloadable from SPSS Developer Central, www.spss.com/devcentral.  You need at least SPSS version 17 to use this.

Here is an example.
MEANS TABLES=educ salary BY jobcat.
SPSSINC MODIFY TABLES subtype="'Report'" SELECT="<<ALL>>"
/STYLES CUSTOMFUNCTION="customstylefunctions.transpose".

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Jinkuk Hong <[hidden email]>
To:        [hidden email]
Date:        11/23/2010 11:06 AM
Subject:        [SPSSX-L] changing report table format in "MEANS"
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi all,
(there should be an easy solution, but I couldn't find one yet...)
I'm running "MEANS" to descriptively compare outcome variables among three groups.
By default, the "report" table presents the result in the format: Group
/Statistics in THE ROW, and Variables in the COLUMN.
Is there a way to change the default setting of the pivot tray so that the
"report" table would have a format of "Variable/Group in the ROW, and
Statistics in the COLUMN"?
I need this type of format for my weekly report (the tables are exported to a
Word document for a report) and with current format I have to change manually
each table using pivoting trays (with more than 50 outcome variables, it's lot
of tables to edit manually....).
Any suggestion or advice would be greatly appreciated.

Best,
Jin

--

=====================
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: changing report table format in

Bruce Weaver
Administrator
In reply to this post by Jinkuk Hong
Jinkuk Hong wrote
Hi all,
(there should be an easy solution, but I couldn't find one yet...)
I'm running "MEANS" to descriptively compare outcome variables among three groups.
By default, the "report" table presents the result in the format: Group
/Statistics in THE ROW, and Variables in the COLUMN.
Is there a way to change the default setting of the pivot tray so that the
"report" table would have a format of "Variable/Group in the ROW, and
Statistics in the COLUMN"?
I need this type of format for my weekly report (the tables are exported to a
Word document for a report) and with current format I have to change manually
each table using pivoting trays (with more than 50 outcome variables, it's lot
of tables to edit manually....).
Any suggestion or advice would be greatly appreciated.

Best,
Jin

--
Here's another option, illustrated with the General Social Survey data set that comes with SPSS.  Modify the !SPSSdata macro as needed.


define !SPSSdata () "C:\Program Files\SPSSInc\PASWStatistics18\Samples\English\" !enddefine.

* Open the 1991 General Social Survey data file.

GET FILE= !SPSSdata + '1991 U.S. General Social Survey.sav'.
DATASET NAME gss WINDOW=FRONT.

means age educ speduc by region.

* User wants to PIVOT the table, but has to
* do so manually.

* Jon suggested using SPSSINC MODIFY TABLES, which
* requires the appropriate Python programmability plugin.

* I have no doubt that this is an excellent solution;
* but I fear that many users will not, or cannot install
* the Python programmability plugin.  Students who use
* SPSS in a university computer lab are one example of
* folks who probably fall in the "cannot" category.

* So, here is a BP solution.
* Use AGGREGATE to write the desired
* summary statistics to another data set.

DATASET DECLARE means_report.
AGGREGATE
  /OUTFILE="means_report"
  /BREAK=region
  /age_mean "AGE: Mean"=MEAN(age)
  /age_nu "AGE: N"=NU(age)
  /age_sd "AGE: SD"=SD(age)
  /educ_mean "Education: Mean"=MEAN(educ)
  /educ_nu "Education: N"=NU(educ)
  /educ_sd "Education: SD"=SD(educ)
  /speduc_mean "Spouse's education: Mean"=MEAN(educ)
  /speduc_nu "Spouse's education: N"=NU(educ)
  /speduc_sd "Spouse's education: SD"=SD(educ)
.

* Now activate that data set, and generate a report.

dataset activate means_report.

Report
  /FORMAT=CHWRAP(ON) PREVIEW(OFF) CHALIGN(BOTTOM) UNDERSCORE(ON) ONEBREAKCOLUMN(OFF) CHDSPACE(1)
    SUMSPACE(0) AUTOMATIC LIST BRKSPACE(0) PAGE(1) MISSING'.' LENGTH(1, 39) ALIGN(LEFT) TSPACE(1)
    FTSPACE(1) MARGINS(1,111)
  /TITLE=LEFT ' )DATE ' CENTER 'MONTHLY REPORT'
  /VARIABLES region (LABELS) (RIGHT) (OFFSET(0))(8)
    age_mean (VALUES) (RIGHT) (OFFSET(0)) (8)
    age_nu (VALUES) (RIGHT) (OFFSET(0)) (8)
    age_sd (VALUES) (RIGHT) (OFFSET(0)) (8)
    educ_mean (VALUES) (RIGHT) (OFFSET(0)) (10)
    educ_nu (VALUES) (RIGHT) (OFFSET(0)) (10)
    educ_sd (VALUES) (RIGHT) (OFFSET(0)) (10)
    speduc_mean (VALUES) (RIGHT) (OFFSET(0)) (10)
    speduc_nu (VALUES) (RIGHT) (OFFSET(0)) (10)
    speduc_sd (VALUES) (RIGHT) (OFFSET(0)) (10) .

* If you don't like REPORT, you can
* use SUMMARIZE instead--but it does not
* display the date.

SUMMARIZE
  /TABLES=age_mean age_nu age_sd educ_mean educ_nu educ_sd speduc_mean speduc_nu speduc_sd BY region    
  /FORMAT=VALIDLIST NOCASENUM TOTAL LIMIT=100
  /TITLE='Monthly Report'
  /MISSING=VARIABLE
  /CELLS=NONE.




--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).