Change total table position

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

dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Change total table position

Postby dhufan dhafani » Wed Sep 05, 2007 3:06 pm

Dear sir,

In spss Default Total tabel position always in right and bottom.
How i can change layout total table? i want total table posisition in Top and Left after Row labels/Column Labels. How i can do it?

Any syntax/script to do it?

Thanks

Dhufan Dhafani
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Wed Sep 05, 2007 3:15 pm

In Custom Tables, when you select Categories & Total, you can choose totals "above categories to which they apply".
In older versions (below 10 or so, such trick was only possible from syntax).

Syntax example:

Code: Select all

CTABLES
  /VLABELS VARIABLES=x y DISPLAY=DEFAULT
  /TABLE x [COUNT F40.0] BY y
  /CATEGORIES VARIABLES=x y ORDER=A KEY=VALUE EMPTY=EXCLUDE
  TOTAL=YES POSITION=BEFORE.
the key command for that is
POSITION=AFTER/BEFORE
please chcek also command reference
statman
Administrator
Posts: 2721
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Postby statman » Wed Sep 05, 2007 7:07 pm

I believe Smash's reference as
when you select Categories & Total, you can choose totals "above categories to which they apply".
Is only for subtotals in category lists. For row or column totals this has to be done via syntax using the POSITION=AFTER/BEFORE option
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Wed Sep 05, 2007 8:00 pm

statman wrote:I believe Smash's reference as
when you select Categories & Total, you can choose totals "above categories to which they apply".
Is only for subtotals in category lists.
I use it to construct above syntax, so it should work for both subtotals & totals.
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Thu Sep 06, 2007 6:19 am

thanks for suggestion
the problem now :
1. how i can put total respodents/total cases in the top after column labels?
2. how i can put total Column in the left after row labels?
How i can do this in spss outputs?
any script/ syntax to do it?

Thanks
Dhufan dhafani
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Thu Sep 06, 2007 8:10 am

I thought that suggestions give you the answer, but maybe we don't know all detailes.
Please, describe what exactly should be presented in the table, could be example of table/syntax to reformat.
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Thu Sep 06, 2007 9:49 am

I am sorry, my description is confuse
Format tables that i mean as like this :

Code: Select all

   		                    Total	 B       C	
			                           B1  B2  C1  C2
S3. ABCDE	Total Respondents	n	n	n	n	n
	                        A1	%	%	%	%	%
	                        A2	%	%	%	%	%
	                        A3	%	%	%	%	%
	                        A4	%	%	%	%	%
	                        A5	%	%	%	%	%
Total	                 Total  %   %	%	%	%
 
Any script/ syntax for format tables it ?

Thanks

Dhufan dhafani
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Thu Sep 06, 2007 10:32 am

Unfortunately, it isn't possible to create two statistics in sum, and one of them is above, one below. Both of them (n & %) should be above or below. Even syntax doesn't give such possibility, because command for totals is separate from command of possition of totals.

Example of table with table % total on begining and n & % total on the bottom:

Code: Select all

CTABLES
  /VLABELS VARIABLES=B C ABCDE DISPLAY=DEFAULT
  /TABLE ABCDE [TABLEPCT.COUNT PCT40.1, TOTALS[COUNT F40.0, TABLEPCT.COUNT PCT40.1]] BY B [C] + C [C]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=B ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=BEFORE
  /CATEGORIES VARIABLES=C ORDER=A KEY=VALUE EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=ABCDE ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER.
We can use simple trick to create n on the begining of the table.
For this we create another variable and depending on what it should present we put there a values '1' or missing.
Example:

Code: Select all

recode ABCDE (sysmis=sysmis) (else=1) into NNN.
exec.
CTABLES
  /VLABELS VARIABLES=B C NNN ABCDE DISPLAY=DEFAULT
  /TABLE NNN [COUNT F40.0] + ABCDE [TABLEPCT.COUNT PCT40.1] BY B [C] + C [C]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=B ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=BEFORE
  /CATEGORIES VARIABLES=C ORDER=A KEY=VALUE EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=ABCDE ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER.
I hope, it would help you to find a solution.
Final code would be little different depends on type of variable and other details of the table, like type of percent presented (column/row/table) and so on.
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Thu Sep 06, 2007 12:13 pm

Thanks you very much
Great idea....

There is still some request and asking :
1. How i can Exclude "Table N %" ?
2. How i Can do it for "Multiple Response sets" data ?
3. If, i want Percentage by row, not by column, how i can do it ?

Thanks

Dhufan dhafani
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Fri Sep 07, 2007 1:29 pm

Ad 1. It is posssible to exclude all labels by puting command VISIBLE=NO

Code: Select all

/SLABELS POSITION={ROW/COLUMN} [VISIBLE={YES/NO}]
If you want to exclude only the label "Table N %" (not the Count from NNN), you can add your own label, but it must be something, could be ""

Code: Select all

ABCDE [TABLEPCT.COUNT '' PCT40.1] 
Ad 3. What do you mean, showing row percent (a)? or putting labels in column (b)?
a - Instead of table percent use the row percent (simple example):
[TABLEPCT.COUNT '%' PCT40.1] - table percent from number of cases/answers presented in %format with 1 digit after comma with label '%'
[ROWPCT.COUNT 'example' PCT40.0] - row percent from number of cases/answers presented in %format with 0 digit after comma with label 'example'
[COLPCT.COUNT PCT40.2] - column percent from number of records presented in %format with 2 digit after comma with standard label

b - I don't recommend in case of artificial variable NNN, becasue the look of table is awful. Better to prepare two separate tables and join them in Excel (sorry, but the thing I hate in SPSS is output format :D ).
The line of command for positioning labels is:

Code: Select all

/SLABELS POSITION={ROW/COLUMN} [VISIBLE={YES/NO}
For more details about CTABLES command, please check the syntax help (F1 in syntax command) in SPSS.

Ad 2. Which varaible is the multiple set? what you would like to present as % & N - number of answers or number of responders ?

your welcome
Smash
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Fri Sep 07, 2007 3:22 pm

Thanks very much.
The Response is very good.

Sorry, my description is confuse, i will try to explain as bellow:

1. Percentage row/ column as same as what you say.
2. "Multiple Response sets" is where respondent can answer more than one answer (multiple answer). how i can modified the script/ syntax for the case ?
3. %/n is percentages/number of respondents.

i can't do it, if the respondents answer is multiple answer, how i can do it with script/ syntax fo this?

Thanks
Dhufan
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Fri Sep 07, 2007 4:58 pm

dhufan dhafani wrote:2. "Multiple Response sets" is where respondent can answer more than one answer (multiple answer). how i can modified the script/ syntax for the case ?
Sorry Dhufan, we can't go father with our both misunderstanding :)
Ok, I know what is multiple response set, but my question was rather :
Which of your variables in table (ABCDE/B/C) is the multiple one ?
Hope, now I am clear :) . English is not my native language.
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Sat Sep 08, 2007 3:21 am

i am sorry too

ABCD is Multiple answer
B is single answer, and
C is single answer.

Sorry mr for missunderstanding.
Thanks
Dhufan
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Tue Sep 11, 2007 1:17 pm

If you already defined multiple response set in the table new option accours like:
Responses - count number of answers, not number of responders
Column Response % - same
Depending how you would like to see percents you can use both of them.

Let say that ABCDE is multiple data, please check below syntax:

Code: Select all

CTABLES
  /VLABELS VARIABLES=ABCDE DISPLAY=DEFAULT
  /TABLE ABCDE [COUNT F40.0, COLPCT.COUNT PCT40.1, RESPONSES F40.0, COLPCT.RESPONSES PCT40.1]
  /CATEGORIES VARIABLES=ABCDE ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES
  POSITION=AFTER.
dhufan dhafani
Posts: 24
Joined: Tue Sep 04, 2007 9:03 am

Postby dhufan dhafani » Thu Sep 13, 2007 8:20 am

Thanks mr smash

Who is online

Users browsing this forum: No registered users and 1 guest

cron