Date: Mon, 26 Sep 2005 20:45:04 -0400
Reply-To: Raynald Levesque <rlevesque@videotron.ca>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: Table command in Macro
In-Reply-To: <5101F2BA382BB245A7033EC1E5B8E35501C17E6F@namail2.na.ipsos>
Content-type: text/plain; charset=us-ascii
Hi
Try this:
*////////////////////////////.
DEFINE !Performance (!POS= !CMDEND).
TEMPORARY.
RECODE !1 (1 THRU 4 = 1)(5 THRU 7 = 2)(8 THRU 10 = 3)(ELSE = SYSMIS).
VALUE LABELS !1
1 "Dissatisfied"
2 "Merely Satisfied"
3 "Delighted" .
TABLES
/FORMAT BLANK MISSING('.') /TABLES
( !HEAD(!1) !DO !var !IN (!TAIL(!1)) + !var !DOEND ) BY
(LABELS) > (STATISTICS)
/STATISTICS COUNT ((F5.0) 'Count' )
CPCT ((PCT7.1) '%' )
!ENDDEFINE.
*////////////////////////////.
** Example #1.
DATA LIST LIST /nSatAvay nSatSale nSatProd nSatImpl nSatAvaU.
BEGIN DATA
1 1 1 1 1
END DATA.
SET MPRINT=YES.
!Performance nSatAvay nSatSale nSatProd nSatImpl nSatAvaU.
** Example #2.
DATA LIST LIST /a b c d e f g h .
BEGIN DATA
1 1 1 1 1 1 2 2
2 2 1 2 1 2 1 2
2 3 5 1 2 4 1 2
END DATA.
SET MPRINT=YES.
!Performance a b c d e f g h.
Cheers!
Raynald Levesque Raynald@spsstools.net
Visit my SPSS site: http://www.spsstools.net
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Siraj Ur-rehman
Sent: September 26, 2005 2:57 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Table command in Macro
Hi Guys
I have the following syntax for table commands to run the frequencies.
This syntax works fine and gives me the result as I want. I have to do
the same thing for so many times for different group of variables, so I
am trying to write a macro for this whole thing. Recoding and value
label parts are fine but I have no clue how put these variables in the
table command. I have to have these freqs in the same output as this
table command produce so please let me know if there is a way to
calculate these freqs from macro. Thanks in advance
Siraj
TEMPORARY.
RECODE nSatSale nSatProd nSatImpl nSatAvaU
(1 THRU 4 = 1)(5 THRU 7 = 2)(8 THRU 10 = 3)(ELSE = SYSMIS).
VALUE LABELS
nSatSale nSatProd nSatImpl nSatAvaU
1 "Dissatisfied"
2 "Merely Satisfied"
3 "Delighted" .
TABLES
/FORMAT BLANK MISSING('.') /TABLES
( nSatSale + nSatProd + nSatImpl + nSatAvaU) BY
(LABELS) > (STATISTICS)
/STATISTICS COUNT ((F5.0) 'Count' )
CPCT ((PCT7.1) '%' ) .
execute.
**************************Macro**********************
DEFINE Performance (!POS= !CMDEND).
TEMPORARY.
RECODE !1
(1 THRU 4 = 1)(5 THRU 7 = 2)(8 THRU 10 = 3)(ELSE = SYSMIS).
VALUE LABELS !1
1 "Dissatisfied"
2 "Merely Satisfied"
3 "Delighted" .
execute.
!enddefine.
Performance nSatAvay nSatSale nSatProd nSatImpl nSatAvaU.