macro error

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

macro error

wsu_wright
I have a numeric variable that I wish to use a macro to run a select if

DEFINE !prog ( ) 100101 !ENDDEFINE.
sel if (mc_prog eq !prog).

When I run the macro I get the following error:

>Error # 1.  Command name: (100101
>The first word in the line is not recognized as an SPSS command.
>This command not executed.

I know its a simple error but I can't find it.

Thanks in advance.

David
Reply | Threaded
Open this post in threaded view
|

Re: macro error

Albert-Jan Roskam
Hi David,

Here with SPSS v11 your code does work. Strange. Maybe
if you omit one exclamation mark?

DEFINE prog ( ) 100101 !ENDDEFINE.
sel if (mc_prog eq prog).

Or is there something else going on. Is mc_prog really
numeric? Or is it a string 'disguised as' a numeric
variable?

Cheers!
Albert-Jan

--- David Wright <[hidden email]> wrote:

> I have a numeric variable that I wish to use a macro
> to run a select if
>
> DEFINE !prog ( ) 100101 !ENDDEFINE.
> sel if (mc_prog eq !prog).
>
> When I run the macro I get the following error:
>
> >Error # 1.  Command name: (100101
> >The first word in the line is not recognized as an
> SPSS command.
> >This command not executed.
>
> I know its a simple error but I can't find it.
>
> Thanks in advance.
>
> David
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
Reply | Threaded
Open this post in threaded view
|

Re: macro error

Richard Ristow
In reply to this post by wsu_wright
At 07:47 PM 3/1/2007, David Wright wrote:

>I have a numeric variable that I wish to use a macro to run a select
>if
>
>DEFINE !prog ( ) 100101 !ENDDEFINE.
>sel if (mc_prog eq !prog).
>
>When I run the macro I get the following error:
>
>>Error # 1.  Command name: (100101>The first word in the line is not
>>recognized as an SPSS command.

Like Albert-jan Roskam, I don't see it.

Run as follows; that will show you the code with the macro expanded,
and should make it much easier to see what's happening.

DEFINE !prog ( ) 100101 !ENDDEFINE.
PRESERVE.
SET MPRINT ON.
sel if (mc_prog eq !prog).
RESTORE.

If the problem is still obscure, ask again, giving the output from the
above run.