|
Hi All,
I've been trying to run the following code: VECTOR ROA = ROA94 TO ROA98. VECTOR Assets.19 = Assets.1994 TO Assets.1998. VECTOR Profits.19 = Profits.1994 TO Profits.1998. LOOP #CODE = 94 TO 98. . DO IF MISSING (Assets.19(#CODE)). . COMPUTE ROA(#CODE) = $SYSMIS. . ELSE IF Profits.19(#CODE) eq 0. . COMPUTE ROA(#CODE) = 0. . ELSE . . COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). . END IF. END LOOP. But, I keep getting the following error message: >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. Can someone please tell me what I've been missing? Thanks in advance. Best, Lisa >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< -> .................... <- |
|
Hi
When I correct the line LOOP #CODE = 94 TO 98. to LOOP #CODE = 1 TO 5. The code works without error/warning message. -- Raynald Levesque www.spsstools.net On 10/15/07, Lisa Stickney <[hidden email]> wrote: > > Hi All, > > I've been trying to run the following code: > > VECTOR ROA = ROA94 TO ROA98. > > VECTOR Assets.19 = Assets.1994 TO Assets.1998. > > VECTOR Profits.19 = Profits.1994 TO Profits.1998. > > LOOP #CODE = 94 TO 98. > > . DO IF MISSING (Assets.19(#CODE)). > > . COMPUTE ROA(#CODE) = $SYSMIS. > > . ELSE IF Profits.19(#CODE) eq 0. > > . COMPUTE ROA(#CODE) = 0. > > . ELSE . > > . COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). > > . END IF. > > END LOOP. > > > > > > But, I keep getting the following error message: > > >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. > > > > Can someone please tell me what I've been missing? Thanks in advance. > > > > Best, > > Lisa > > > >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< > -> .................... <- > > ===================== 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 |
|
Thanks, but it also changes my variable names, and I have to do about five sets of these with considerably more than 5 iterations in the loop.
Lisa ----- Original Message ----- From: Raynald Levesque To: Lisa Stickney Cc: [hidden email] Sent: Monday, October 15, 2007 9:14 PM Subject: Re: DO-IF / LOOP Error message Hi When I correct the line LOOP #CODE = 94 TO 98. to LOOP #CODE = 1 TO 5. The code works without error/warning message. -- Raynald Levesque www.spsstools.net On 10/15/07, Lisa Stickney <[hidden email]> wrote: Hi All, I've been trying to run the following code: VECTOR ROA = ROA94 TO ROA98. VECTOR Assets.19 = Assets.1994 TO Assets.1998. VECTOR Profits.19 = Profits.1994 TO Profits.1998. LOOP #CODE = 94 TO 98. . DO IF MISSING (Assets.19(#CODE)). . COMPUTE ROA(#CODE) = $SYSMIS. . ELSE IF Profits.19(#CODE) eq 0. . COMPUTE ROA(#CODE) = 0. . ELSE . . COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). . END IF. END LOOP. But, I keep getting the following error message: >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. Can someone please tell me what I've been missing? Thanks in advance. Best, Lisa >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< -> .................... <- ====================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 lts1
Hi Lisa,
Will a DO REPEAT - END REPEAT alternative work for you? Here's a sample code. DATA LIST FIXED/ASSETS.1994 TO ASSETS.1998 PROFITS.1994 TO PROFITS.1998 1-10. BEGIN DATA. 1211212121 101210 1211 12 10 END DATA. DO REPEAT ROA=ROA94 TO ROA98 /Assets=Assets.1994 TO Assets.1998 /Profits=Profits.1994 TO Profits.1998. . DO IF MISSING (Assets). . COMPUTE ROA = $SYSMIS. . ELSE IF Profits eq 0. . COMPUTE ROA = 0. . ELSE . . COMPUTE ROA = Profits/Assets. . END IF. END REPEAT PRINT. EXECUTE. At 08:11 PM 10/15/2007, Lisa Stickney wrote: >Hi All, > > I've been trying to run the following code: > >VECTOR ROA = ROA94 TO ROA98. > >VECTOR Assets.19 = Assets.1994 TO Assets.1998. > >VECTOR Profits.19 = Profits.1994 TO Profits.1998. > >LOOP #CODE = 94 TO 98. > >. DO IF MISSING (Assets.19(#CODE)). > >. COMPUTE ROA(#CODE) = $SYSMIS. > >. ELSE IF Profits.19(#CODE) eq 0. > >. COMPUTE ROA(#CODE) = 0. > >. ELSE . > >. COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). > >. END IF. > >END LOOP. > > > > > > But, I keep getting the following error message: > > >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. > > > > Can someone please tell me what I've been missing? Thanks in advance. > > > > Best, > > Lisa > > > >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< > -> .................... <- ===================== 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 lts1
Hi Lisa,
Changing LOOP #CODE = 94 TO 98. to LOOP #CODE = 1 TO 5. does *NOT* change your variable names. The following line in your syntax VECTOR Profits.19 = Profits.1994 TO Profits.1998. defines a vector of 5 elements, which are referred to as Profits.19(1) Profits.19(2) ... Profits.19(5) For example, you need to refer to the first element as Profits.19(1) even though it actually refers to Profits.1994. -- Raynald Levesque www.spsstools.net On 10/15/07, Lisa Stickney <[hidden email]> wrote: > > Thanks, but it also changes my variable names, and I have to do about > five sets of these with considerably more than 5 iterations in the loop. > > Lisa > > > > > ----- Original Message ----- > *From:* Raynald Levesque <[hidden email]> > *To:* Lisa Stickney <[hidden email]> > *Cc:* [hidden email] > *Sent:* Monday, October 15, 2007 9:14 PM > *Subject:* Re: DO-IF / LOOP Error message > > Hi > > When I correct the line > LOOP #CODE = 94 TO 98. > to > LOOP #CODE = 1 TO 5. > > The code works without error/warning message. > > -- > Raynald Levesque > www.spsstools.net > > > On 10/15/07, Lisa Stickney <[hidden email]> wrote: > > > > Hi All, > > > > I've been trying to run the following code: > > > > VECTOR ROA = ROA94 TO ROA98. > > > > VECTOR Assets.19 = Assets.1994 TO Assets.1998. > > > > VECTOR Profits.19 = Profits.1994 TO Profits.1998. > > > > LOOP #CODE = 94 TO 98. > > > > . DO IF MISSING (Assets.19(#CODE)). > > > > . COMPUTE ROA(#CODE) = $SYSMIS. > > > > . ELSE IF Profits.19(#CODE) eq 0. > > > > . COMPUTE ROA(#CODE) = 0. > > > > . ELSE . > > > > . COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). > > > > . END IF. > > > > END LOOP. > > > > > > > > > > > > But, I keep getting the following error message: > > > > >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. > > > > > > > > Can someone please tell me what I've been missing? Thanks in > > advance. > > > > > > > > Best, > > > > Lisa > > > > > > >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< > > -> .................... <- > > > > ===================== 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 |
|
My thanks to all - it's working now.
Best, Lisa ----- Original Message ----- From: Raynald Levesque To: Lisa Stickney Cc: [hidden email] Sent: Tuesday, October 16, 2007 7:15 PM Subject: Re: DO-IF / LOOP Error message Hi Lisa, Changing LOOP #CODE = 94 TO 98. to LOOP #CODE = 1 TO 5. does *NOT* change your variable names. The following line in your syntax VECTOR Profits.19 = Profits.1994 TO Profits.1998. defines a vector of 5 elements, which are referred to as Profits.19(1) Profits.19(2) ... Profits.19(5) For example, you need to refer to the first element as Profits.19(1) even though it actually refers to Profits.1994. -- Raynald Levesque www.spsstools.net On 10/15/07, Lisa Stickney <[hidden email]> wrote: Thanks, but it also changes my variable names, and I have to do about five sets of these with considerably more than 5 iterations in the loop. Lisa ----- Original Message ----- From: Raynald Levesque To: Lisa Stickney Cc: [hidden email] Sent: Monday, October 15, 2007 9:14 PM Subject: Re: DO-IF / LOOP Error message Hi When I correct the line LOOP #CODE = 94 TO 98. to LOOP #CODE = 1 TO 5. The code works without error/warning message. -- Raynald Levesque www.spsstools.net On 10/15/07, Lisa Stickney <[hidden email]> wrote: Hi All, I've been trying to run the following code: VECTOR ROA = ROA94 TO ROA98. VECTOR Assets.19 = Assets.1994 TO Assets.1998. VECTOR Profits.19 = Profits.1994 TO Profits.1998. LOOP #CODE = 94 TO 98. . DO IF MISSING (Assets.19(#CODE)). . COMPUTE ROA(#CODE) = $SYSMIS. . ELSE IF Profits.19(#CODE) eq 0. . COMPUTE ROA(#CODE) = 0. . ELSE . . COMPUTE ROA(#CODE) = Profits.19(#CODE)/Assets.19(#CODE). . END IF. END LOOP. But, I keep getting the following error message: >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. Can someone please tell me what I've been missing? Thanks in advance. Best, Lisa >>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<< -> .................... <- ====================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 Raynald Levesque-2
Dear all,
Just out of curiosity, does anyone know please when it's going to be possible to save data files as files for STATA 10/SE? Files saved for Version 8 (which is the latest option listed by SPSS) work OK in STATA 10, but still . . . Thanks, Judith Saebel ====================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 |
