S,
you were almost there i.e., enclosing the condition with quotes. after
doing that make sure you !unquote !grp.
try this code.
Florio
DEFINE !mygroup (!pos !tokens(2)).
!do !grp !in (!1).
temporary.
select if (!unquote(!grp)).
freq var gender.
!doend.
!ENDDEFINE.
!mygroup "groupid>=1" "groupid<=2"
At 01:14 PM 2/23/2010, ksven wrote:
>Hi there -
>I am trying to run the same procedures for different subgroups based on a
>group variable.
>Group 1 is defined by groupid>=1 and group 2 is defined by groupid<=2.
>The following would run a frequency on gender:
>
>DEFINE !mygroup (!pos !tokens(2)).
>!do !grp !in (!1).
>temporary.
>select if (!grp).
>freq var gender.
>!doend.
>!ENDDEFINE.
>
>!mygroup groupid>=1 groupid<=2.
>
>
>This obviously does not work since SPSS does recognize take groupid>=1 and
>groupid <=2 as single strings.
>But enclosing them in quotes will yield a sel if ("groupid>=1") statement
>which does not work.
>I looked into the !enclose command but without success. Not sure if it can
>be combined with !pos or !cmdend or !charend ....
>Any ideas would be welcome!
>Best,
>Sven
>
>
>
>--
>View this message in context:
>
http://old.nabble.com/Looping-over-group-identifier-defined-by-range-of-values---macro-help-needed-tp27707770p27707770.html>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
>=====================
>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