LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 3 Jul 2006 12:40:13 +0100
Reply-To:     Michael Pearmain <Michael.Pearmain@tangozebra.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Michael Pearmain <Michael.Pearmain@tangozebra.com>
Subject:      Macro tokens problem with commas
Content-Type: text/plain; charset="iso-8859-1"

Hi All,

I'm still having a problems defining a list which include commas, so far my best efforts have failed, although I have now my latest idea and reasons are detailed underneath I still fail. If anyone has any suggestions I would be most grateful

Original macro

DEFINE !VARSCOM(). !QUOTE(!CONCAT("n_4, n_5, n_6, n_7, n_8, n_9"))) !QUOTE(!CONCAT("n_10, n_11, n_12, n_13, n_14, n_15")) !QUOTE(!CONCAT("n_16, n_17, n_18, n_19, n_20, n_21")) !QUOTE(!CONCAT("n_22, n_23, n_24, n_25, n_26") ) !QUOTE(!CONCAT("n_27, n_28, n_29, n_30, n_31") ) !QUOTE(!CONCAT("n_32, n_33, n_34, n_35, n_36, n_37") ) !QUOTE(!CONCAT("n_39, n_40, n_41, n_42, n_43, n_44, n_45, n_46, n_47")) !QUOTE(!CONCAT("n_48, n_49, n_50, n_51, n_52, n_53, n_54, n_55, n_56") ) !QUOTE(!CONCAT("n_57, n_58, n_59, n_60, n_61, n_62, n_63, n_64, n_65") ) !QUOTE(!CONCAT("n_66, n_67, n_68, n_69, n_70")) !ENDDEFINE.

The aim is to create 10 tokens and then to place into another macro.

These 10 tokens being

1. n_4, n_5, n_6, n_7, n_8, n_9 2. n_10, n_11, n_12, n_13, n_14, n_15 3. n_16, n_17, n_18, n_19, n_20, n_21 4. n_22, n_23, n_24, n_25, n_26 5. n_27, n_28, n_29, n_30, n_31 6. n_32, n_33, n_34, n_35, n_36, n_37 7. n_39, n_40, n_41, n_42, n_43, n_44, n_45, n_46, n_47 8. n_48, n_49, n_50, n_51, n_52, n_53, n_54, n_55, n_56 9. n_57, n_58, n_59, n_60, n_61, n_62, n_63, n_64, n_65 10. n_66, n_67, n_68, n_69, n_70

My reasons for the !Quote !concat fucntions come from the following logic.

!UPCASE(!CONCAT('a,b,c')) = A,B,C (So the !concat function would allow me to keep the comma's !QUOTE('abc') = abc (So this would allow the macro to be read as 10 single tokens and not 66 different tokens)

My aim would be in my other macro to use the !UNQUOTE function in order to remove the quotation marks

As in /CATEGORIES VARIABLES=$Q3 [!UNQUOTE(!VOUT)] EMPTY=INCLUDE.

Where !Vout is the macro I am inserting the variable into

Giving me the following (expanded) line

/CATEGORIES VARIABLES=$Q3 [n_4, n_5, n_6, n_7, n_8, n_9] EMPTY=INCLUDE.

Many thanks in advance

Mike

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Marta García-Granero Sent: 28 June 2006 16:48 To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Macro tokens problem with commas

Hi Michael,

Have you tried this MACRO definition? (untested):

DEFINE !METRICS(!POSITIONAL=!CHAREND('/')/!POSITIONAL=!CMDEND).

Then your MACRO call would be:

!METRICS n_4,n_5,n_6,n_7,n_8,n_9 / n_10,n_11,n_12,n_13,n_14,n_15.

MP> I'm currently trying to enter a string of variable into another MP> macro call... I want to include the commas as part of the string MP> variable but SPSS seems to recognise the comma as a separator for MP> different tokens.

MP> So my original macro may as below (Shortened for ease of writing, MP> i.e. just showing two tokens)

MP> DEFINE !VARSCOMMA(). MP> "n_4, n_5, n_6, n_7, n_8, n_9" -This is the first string I want entered without "" MP> "n_10, n_11, n_12, n_13, n_14, n_15" -This is the second MP> string I want entered without "" MP> !ENDDEFINE.

MP> I want to input this into the following macro call

MP> DEFINE !METRICS(!POSITIONAL !TOKENS(10) MP> /!POSITIONAL !TOKENS(10)). MP> !LET !VIN =!1. MP> !LET !VOU = !2. MP> !DO !S !IN (!VIN). MP> LET !VOUT = !HEAD(!VOU).

MP> *OMS. MP> DATASET DECLARE Ctables. MP> OMS MP> /SELECT TABLES MP> /IF COMMANDS = ["CTables"] MP> SUBTYPES = ["Custom Table"] MP> /DESTINATION FORMAT = SAV NUMBERED = TableNumber_ MP> OUTFILE = Ctables MP> Viewer = NO. MP> * Custom Tables. MP> CTABLES MP> /VLABELS VARIABLES=ControlGrp !S DISPLAY=DEFAULT /TABLE !S [COUNT MP> F40.0] BY ControlGrp /SLABELS VISIBLE=NO /CATEGORIES MP> VARIABLES=ControlGrp ORDER=A KEY=VALUE EMPTY=INCLUDE /CATEGORIES MP> VARIABLES=!S [!UNQUOTE(!VOUT)] EMPTY=INCLUDE. MP> CTABLES MP> /VLABELS VARIABLES=ControlGrp exposed DISPLAY=DEFAULT MP> /TABLE exposed [COUNT F40.0] BY ControlGrp MP> /SLABELS VISIBLE=NO MP> /CATEGORIES VARIABLES=ControlGrp ORDER=A KEY=VALUE EMPTY=INCLUDE MP> /CATEGORIES VARIABLES=exposed ORDER=A KEY=VALUE EMPTY=EXCLUDE. MP> OMSEND.

MP> SO the bold line reads MP> /CATEGORIES VARIABLES=!S [n_4, n_5, n_6, n_7, n_8, n_9] EMPTY=INCLUDE.

HTH, Marta mailto:biostatistics@terra.es

________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________

______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________


Back to: Top of message | Previous page | Main SPSSX-L page