Date: Fri, 5 Aug 2011 07:48:50 -0700
Reply-To: Bruce Weaver <bruce.weaver@hotmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Bruce Weaver <bruce.weaver@hotmail.com>
Subject: Re: Unclosed loop
In-Reply-To: <1312553595614-4669655.post@n5.nabble.com>
Content-Type: text/plain; charset=us-ascii
I don't see anything wrong. But DO-IF with that many ELSE lines is always a
bit hard to read. I think something like the following (untested) might
work. If it does, it's a lot easier to read.
do repeat i = 1 to 8 / y1 = 1999 to 2006 / y2 = 2000 to 2007.
- if RANGE(reldate,date.mdy(4,1,y1),date.mdy(3,31,y2)) fy = i.
end repeat.
execute.
HTH.
shorne wrote:
>
> 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.
>
-----
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Unclosed-loop-tp4669655p4669757.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
|