DEFINE command

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DEFINE command

Samir Omerovic
Hi to all,

 

Let me first wish you all Merry Christmas and Happy New Year.

I have a question about DEFINE command. This is the syntax I am trying to make work:

 

DEFINE test (!POS !token(1)

             /!POS !token(1)).

 

DO IF (p27_!1=P26)

Compute test=1.

Execute.

 

!ENDDEFINE.

 

test 28.

 

I know this can be done with ANY command but I have some similar issues where I can not use this or
something else. So basically I want to ask if I can use these tokens !1, !2 etc. as a replacement
for a part of variables name (like Compute test!1=***)?

 

Is there a way to do this in SPSS.

 

BR

Samir

 

 

Samir Omerovic
Researcher
___________________________
GfK BH d.o.o.
Skenderija 44
71 000 Sarajevo
Bosnia and Herzegovina
Phone +387 33 550 300
Fax +387 33 444 226
[hidden email]
www.gfk.ba



Before printing this e-mail, please consider environment protection.

This e-mail (and any attachment/s) contains confidential and/or privileged information. If you are
not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and destroy this e-mail.  Any
unauthorized copying, disclosure or
 distribution of the material in this e-mail is strictly forbidden.

Ova e-poruka sadrži povjerljive i/ili povlaštene podatke. Ako niste osoba naznačena kao primalac
molimo odmah upozoriti pošiljaoca
i uništiti primljenu e-poruku. Neautorizirano kopiranje, objavljivanje ili distribucija sadržaja iz
elektronske poruke striktno je zabranjeno.

 

====================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
Reply | Threaded
Open this post in threaded view
|

Re: DEFINE command

Albert-Jan Roskam
Hi Samir,

Happy new year to you too!

I think !CONCAT is what you're looking for:

DEFINE test (!POS !token(1) /!POS !token(1)).

DO IF (!concat(p27_,!1)=P26).
+ Compute test=1.
end if.
Execute.

!ENDDEFINE.

test 28.

In addition, use SET MPRINT = ON. to see what you're
doing.

Cheers!!
Albert-Jan




--- Samir Omerovic <[hidden email]> wrote:

> Hi to all,
>
>
>
> Let me first wish you all Merry Christmas and Happy
> New Year.
>
> I have a question about DEFINE command. This is the
> syntax I am trying to make work:
>
>
>
> DEFINE test (!POS !token(1)
>
>              /!POS !token(1)).
>
>
>
> DO IF (p27_!1=P26)
>
> Compute test=1.
>
> Execute.
>
>
>
> !ENDDEFINE.
>
>
>
> test 28.
>
>
>
> I know this can be done with ANY command but I have
> some similar issues where I can not use this or
> something else. So basically I want to ask if I can
> use these tokens !1, !2 etc. as a replacement
> for a part of variables name (like Compute
> test!1=***)?
>
>
>
> Is there a way to do this in SPSS.
>
>
>
> BR
>
> Samir
>
>
>
>
>
> Samir Omerovic
> Researcher
> ___________________________
> GfK BH d.o.o.
> Skenderija 44
> 71 000 Sarajevo
> Bosnia and Herzegovina
> Phone +387 33 550 300
> Fax +387 33 444 226
> [hidden email]
> www.gfk.ba
>
>
>
> Before printing this e-mail, please consider
> environment protection.
>
> This e-mail (and any attachment/s) contains
> confidential and/or privileged information. If you
> are
> not the intended recipient (or have
> received this e-mail in error) please notify the
> sender immediately and destroy this e-mail.  Any
> unauthorized copying, disclosure or
>  distribution of the material in this e-mail is
> strictly forbidden.
>
> Ova e-poruka sadr¾i povjerljive i/ili povla¹tene
> podatke. Ako niste osoba naznaèena kao primalac
> molimo odmah upozoriti po¹iljaoca
> i uni¹titi primljenu e-poruku. Neautorizirano
> kopiranje, objavljivanje ili distribucija sadr¾aja
> iz
> elektronske poruke striktno je zabranjeno.
>
>
>
> ====================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
>



      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

=====================
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