« Return to Thread: LOOP Command

Re: LOOP Command

by Oliver, Richard :: Rate this Message:

Reply to Author | View in Thread

Are you sure Fecha_UP and Fecha_Deliv are date format numeric variables, not string dates?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@...] On Behalf Of Libardo Lopez
Sent: Wednesday, July 08, 2009 5:23 PM
To: SPSSX-L@...
Subject: LOOP Command

Dear Listers, i would appreciate your help to solve this problem.

I need to count  the labor days between two dates excluding some public
holidays.
This Sintax works fine with SPSS V16, but right now I Have Just V17 and does
not works.

COMPUTE DiasHabiles = 0.
LOOP # = Fecha_UP to Fecha_Deliv BY 86400.
If RANGE(XDATE.WKDAY(#),2,7) & ~ANY(#,
DATE.DMY(1,1,2009),
DATE.DMY(12,1,2009),
DATE.DMY(1,1,2008),
DATE.DMY(7,1,2008)
)
DiasHabiles = DiasHabiles + 1.
END LOOP.
EXECUTE .

Warnings…
LOOP The equals sign on the LOOP command must be followed by a numeric
expression.
LOOP The keyword TO on the LOOP command must be followed by a numeric
expression.
Error Messages:
LOOP # = Fecha_UP to Fecha_Deliv BY 86400.
 >Error # 4849.  Command name: LOOP >The equals sign on the LOOP command
must be followed by a numeric expression. >This command not executed.
>Error # 4850.  Command name: LOOP >The keyword TO on the LOOP command must
be followed by a numeric expression.

Remark: Fecha_UP and Fecha_Deliv  are Dates.

All Ideas are wellcome, Thanks in advance,

Lee

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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
LISTSERV@... (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

 « Return to Thread: LOOP Command