Date: Wed, 29 Sep 2010 09:31:49 +0200
Reply-To: Marta García-Granero <mgarciagranero@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Marta García-Granero <mgarciagranero@gmail.com>
Subject: Re: Frequency table when one does not have CTABLES
In-Reply-To: <4CA2E895.900@googlemail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
El 29/09/2010 9:19, targetlinkmark@gmail.com escribió:
> Sorry - I wasn't clear enough.
> My brands aren't in one variable.
> Each brand has it's own variable [column] in which the brands
> consumption is indicated.
>
> Record Brand A Brand B
> 1 2 3
> 2 1 2
> 3 3 3
>
> So it's a summary crosstab showing only the total columns for each brand.
OK, what about this then?
DATA LIST LIST/Record BrandA BrandB (3 F8).
BEGIN DATA
1 2 3
2 1 2
3 3 3
END DATA.
COMPUTE K=1.
AGGREGATE
/OUTFILE=*
MODE=ADDVARIABLES
/BREAK=K
/BrandA_sum = SUM(BrandA)
/BrandB_sum = SUM(BrandB).
COMPUTE PercentA = 100*BrandA/BrandA_sum .
COMPUTE PercentB = 100*BrandB/BrandB_sum .
FORMAT PercentA PercentB (Pct8.1).
VAR LABEL PercentA 'Brand A (%)' PercentB 'Brand B (%)'.
SUMMARIZE
/TABLES=PercentA PercentB
/FORMAT=LIST NOCASENUM TOTAL
/TITLE='Percent by Brand'
/MISSING=VARIABLE
/CELLS=NONE.
--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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