To illustrate my point:
data list free /fecha_up fecha_deliv (2adate10).
begin data
10/28/1986 7/08/2009
10/29/1987 7/08/2009
end data.
*This 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 .
ALTER TYPE all (adate10=a10).
*This doesn't because dates are now actually strings.
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 .
-----Original Message-----
From: Oliver, Richard
Sent: Thursday, July 09, 2009 9:24 AM
To: 'Libardo Lopez';
SPSSX-L@...
Subject: RE: LOOP Command
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