Unclosed loop

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

Unclosed loop

shorne
Using the following code in SPSS 11 and get the following error: >Error # 4095. Command name: EXECUTE >The transformations program contains an unclosed LOOP, DO IF, or complex >file structure. Use the level-of-control shown to the left of the SPSS >commands to determine the range of LOOPs and DO IFs. >This command not executed. Am I missing something at the bottom? Do if reldate >= date.mdy(4,1,1999) and reldate <= date.mdy(3,31,2000). comp fy=1. ELSE if reldate >= date.mdy(4,1,2000) and reldate <= date.mdy(3,31,2001). comp fy=2. ELSE if reldate >= date.mdy(4,1,2001) and reldate <= date.mdy(3,31,2002). comp fy=3. ELSE if reldate >= date.mdy(4,1,2002) and reldate <= date.mdy(3,31,2003). comp fy=4. ELSE if reldate >= date.mdy(4,1,2003) and reldate <= date.mdy(3,31,2004). comp fy=5. ELSE if reldate >= date.mdy(4,1,2004) and reldate <= date.mdy(3,31,2005). comp fy=6. ELSE if reldate >= date.mdy(4,1,2005) and reldate <= date.mdy(3,31,2006). comp fy=7. ELSE if reldate >= date.mdy(4,1,2006) and reldate <= date.mdy(3,31,2007). comp fy=8. END IF. EXECUTE.
Reply | Threaded
Open this post in threaded view
|

Re: Unclosed loop

Rich Ulrich
I had to edit to put in carriage returns to get a readable version of this.
I don't see the problem.

But you can simplify the logic if you subtract 1999 from the year, and
then add 1 if the month is 4 or more.  Set to missing if not (1-8)

--
Rich Ulrich


Date: Fri, 5 Aug 2011 07:12:48 -0700
From: [hidden email]
Subject: Unclosed loop
To: [hidden email]

Using the following code in SPSS 11 and get the following error:
>Error # 4095. Command name: EXECUTE
>The transformations program contains an unclosed LOOP, DO IF, or complex
>file structure. Use the level-of-control shown to the left of the SPSS
>commands to determine the range of LOOPs and DO IFs.
>This command not executed. Am I missing something at the bottom?
Do if reldate >= date.mdy(4,1,1999) and reldate <= date.mdy(3,31,2000).
 comp fy=1.
ELSE if reldate >= date.mdy(4,1,2000) and reldate <= date.mdy(3,31,2001).
 comp fy=2.
ELSE if reldate >= date.mdy(4,1,2001) and reldate <= date.mdy(3,31,2002).
 comp fy=3.
ELSE if reldate >= date.mdy(4,1,2002) and reldate <= date.mdy(3,31,2003).
 comp fy=4.
ELSE if reldate >= date.mdy(4,1,2003) and reldate <= date.mdy(3,31,2004).
 comp fy=5.
ELSE if reldate >= date.mdy(4,1,2004) and reldate <= date.mdy(3,31,2005).
 comp fy=6.
ELSE if reldate >= date.mdy(4,1,2005) and reldate <= date.mdy(3,31,2006).
 comp fy=7.
ELSE if reldate >= date.mdy(4,1,2006) and reldate <= date.mdy(3,31,2007).
 comp fy=8.
END IF.
EXECUTE.

View this message in context: Unclosed loop
Sent from the SPSSX Discussion mailing list archive at Nabble.com.