|
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 [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 |
|
Are you sure Fecha_UP and Fecha_Deliv are date format numeric variables, not string dates?
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Libardo Lopez Sent: Wednesday, July 08, 2009 5:23 PM To: [hidden email] 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 [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 |
|
In reply to this post by Libardo López Guzmán
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'; [hidden email] 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:[hidden email]] On Behalf Of Libardo Lopez Sent: Wednesday, July 08, 2009 5:23 PM To: [hidden email] 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 [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 |
| Free forum by Nabble | Edit this page |
