I'm trying to write a Syntax in SPSS to look at a listed variable (FYCount) and code a new variable (FYStart) with a date that corresponds to the FYCount. Because there are 13 different FYCount variables, I've tried to do it efficiently with a DO IF ELSE IF loop, but it tells me that I haven't closed the loop. I've toggled with it for a while now and don't see why it isn't closing and executing the command. Any help for this beginner-level question would be much-appreciated!
Here's the code I have:
do if FYCount = 1.
compute FYStart = date.dmy(1,7,2003).
else if FYCount = 2.
compute FYStart = date.dmy(1,7,2004).
else if FYCount = 3.
compute FYStart = date.dmy(1,7,2005).
else if FYCount = 4.
compute FYStart = date.dmy(1,7,2006).
else if FYCount = 5.
compute FYStart = date.dmy(1,7,2007).
else if FYCount = 6.
compute FYStart = date.dmy(1,7,2008).
else if FYCount = 7.
compute FYStart = date.dmy(1,7,2009).
else if FYCount = 8.
compute FYStart = date.dmy(1,7,2010).
else if FYCount = 9.
compute FYStart = date.dmy(1,7,2011).
else if FYCount = 10.
compute FYStart = date.dmy(1,7,2012).
else if FYCount = 11.
compute FYStart = date.dmy(1,7,2013).
else if FYCount = 12.
compute FYStart = date.dmy(1,7,2014).
else if FYCount = 13.
compute FYStart = date.dmy(1,7,2015).
end if.
When I run it, I get this message: Warning # 142. Command name: EXECUTE LOOP has no effect on this command.
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 Statistics commands to determine the range of LOOPs and DO IFs. Execution of this command stops
Any ideas?