Cross tab output format...

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

Cross tab output format...

Kulvinder Singh
Hi Friends,

Has anyone got any idea that how we can get the following output in SPSS.

Ques: Question Label 1

 Total Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7
Total 213 20 21 6 20 80 9 57
 100% 100% 100% 100% 100% 100% 100% 100%

Row 1 6 0 0 6 0 0 6 0
 3% 0% 0% 3% 0% 0% 3% 0%

Row 2 100 0 0 100 0 0 100 0
 47% 0% 0% 47% 0% 100% 47% 0%

Row 3 20 20 0 20 20 0 20 20
 9% 100% 0% 9% 100% 0% 9% 100%

Row 4 21 0 21 21 0 21 21 0
 10% 0% 100% 10% 0% 0% 10% 0%

Row 5 9 0 0 9 0 0 9 0
 4% 0% 0% 4% 0% 0% 4% 0%

Row 6 57 0 0 57 0 0 57 0
 27% 0% 0% 27% 0% 0% 27% 0%



Kulvinder

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

Fwd: Cross tab output format...

Matt Remigy
Hi - Does this do the trick ? The output is CSVed for alignment.

Matt.


DATA LIST LIST / dummy col1 col2 col3.
BEGIN DATA
1 1 2 4
1 3 5 4
1 2 5 4
1 7 6 6
END DATA.

* get overall total .
* ----------------- .

AGGREGATE OUTFILE = * MODE = ADDVARIABLES
  / BREAK = dummy
  / scol1 = sum(col1)
  / scol2 = sum(col2)
  / scol3 = sum(col3).
MATCH FILES FILE = * / BY = dummy / FIRST = top.
EXECUTE.
COMPUTE rown = $CASENUM.
COMPUTE colp1 = 100*col1/scol1.
COMPUTE colp2 = 100*col2/scol2.
COMPUTE colp3 = 100*col3/scol3.
DO IF top.
WRITE OUTFILE = 'c:\report.csv'
 / 'TOTAL ,COL1,COL2,COL3'
 / '    ,',scol1,',',scol2,',',scol3.
END IF.
WRITE OUTFILE = 'c:\report.csv'
  / 'ROW ',rown,',',col1 ,',' ,col2 ,',' ,col3
  / '    ','  ',',',colp1,'%,',colp2,'%,',colp3,'%'.
EXECUTE.


---------- Forwarded message ----------
From: Kulvinder Singh <[hidden email]>
Date: Nov 15, 2007 9:25 AM
Subject: Cross tab output format...
To: [hidden email]

Hi Friends,

Has anyone got any idea that how we can get the following output in SPSS.

Ques: Question Label 1

Total Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7
Total 213 20 21 6 20 80 9 57
100% 100% 100% 100% 100% 100% 100% 100%

Row 1 6 0 0 6 0 0 6 0
3% 0% 0% 3% 0% 0% 3% 0%

Row 2 100 0 0 100 0 0 100 0
47% 0% 0% 47% 0% 100% 47% 0%

Row 3 20 20 0 20 20 0 20 20
9% 100% 0% 9% 100% 0% 9% 100%

Row 4 21 0 21 21 0 21 21 0
10% 0% 100% 10% 0% 0% 10% 0%

Row 5 9 0 0 9 0 0 9 0
4% 0% 0% 4% 0% 0% 4% 0%

Row 6 57 0 0 57 0 0 57 0
27% 0% 0% 27% 0% 0% 27% 0%



Kulvinder

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