Hello all, I am using SPSS 15 (issue below also happens in 14) to run a
macro for scoring. When I attempt to run the macro and the sytax to feed the variables into the macro at the same time I get multiple "Error #4285 in column X. Text: macro" in the output. However, when I run the syntax before the macro and including the macro, THEN run the syntax that feeds the variables into the macro I get no errors. Also, under both ways of running the sytax, the scoring appears to be the same. My questions is this: Why do I get errors when I run the syntax for the macro and the calls to that macro at the time, opposed to when I just run the macro syntax, then seperatley run the calls to that macro? Is it just convention that you "load/Run" the macro, then make calls to it only after it is loaded? Thanks for any help on this. Jeff COMMENT Creates TRINTotal variable (must have "something" in variable to work. Also, adds valus label. COMPUTE TRINTotal = 0. EXECUTE. VARIABLE LABELS TRINTotal 'Raw score total for the True Response Inconsistency Validity Scale.'. VALUE LABELS TRINTotal -9 'Missing responses, TRIN score not computed.'. COMMENT Macro for scoring appropriatley (not yielding a score for missing data, or data that is not 1, 2, or does not adhere to scoring guide). DEFINE CalcTRINTotal (!POSITIONAL !TOKENS(1) /!POSITIONAL !TOKENS(2)) DO IF (TRINTotal ~= -9). IF (!1 = 1 & !2 = 1) TRINTotal = TRINTotal + 2. IF (!1 = 1 & !2 = 2) TRINTotal = TRINTotal + 1. IF (!1 = 2 & !2 = 1) TRINTotal = TRINTotal + 1. IF (MISSING(!1) = 1) TRINTotal = -9. IF (MISSING(!2) = 1) TRINTotal = -9. END IF. EXECUTE. !ENDDEFINE. COMMENT Sends each variable pairing to CalcTRINTotal macro for processing. CalcTRINTotal snap6 snap69. CalcTRINTotal snap19 snap217. CalcTRINTotal snap24 snap96. CalcTRINTotal snap25 snap105. CalcTRINTotal snap31 snap181. CalcTRINTotal snap37 snap41. CalcTRINTotal snap45 snap183. CalcTRINTotal snap47 snap127. CalcTRINTotal snap49 snap215. CalcTRINTotal snap57 snap82. CalcTRINTotal snap84 snap95. CalcTRINTotal snap98 snap161. CalcTRINTotal snap109 snap194. CalcTRINTotal snap129 snap200. CalcTRINTotal snap133 snap224. CalcTRINTotal snap140 snap218. CalcTRINTotal snap141 snap153. CalcTRINTotal snap167 snap226. CalcTRINTotal snap190 snap206. CalcTRINTotal snap212 snap225. |
Hi Jeff,
Did you try using SET MPRINT = ON already? It helps in solving problems. A few other things that I do not understand: --why does the second positional argument have two tokens? Shouldn't it be just one? --Is the IF MISSING part okay? How about: if (missing (!1)) TRINTotal = -9. You might also want to make it a missing value: MISSING VALUES TRINTotal (-9). --why does the DO IF start with 'ne -9' when you're already sure that trinttotal is never equal to -9? Do you really need the DO IF? --you can probably omit the last EXECUTE, or move it to after the macro calls. --why is the situation when both input variables are equal to 2 not coded? Good luck, hope this helps. Albert-Jan --- Jeff Galecki <[hidden email]> wrote: > Hello all, I am using SPSS 15 (issue below also > happens in 14) to run a > macro for scoring. When I attempt to run the macro > and the sytax to feed > the variables into the macro at the same time I get > multiple "Error #4285 > in column X. Text: macro" in the output. However, > when I run the syntax > before the macro and including the macro, THEN run > the syntax that feeds > the variables into the macro I get no errors. Also, > under both ways of > running the sytax, the scoring appears to be the > same. My questions is > this: Why do I get errors when I run the syntax for > the macro and the > calls to that macro at the time, opposed to when I > just run the macro > syntax, then seperatley run the calls to that macro? > Is it just convention > that you "load/Run" the macro, then make calls to it > only after it is > loaded? Thanks for any help on this. > > Jeff > > > COMMENT Creates TRINTotal variable (must have > "something" in variable to > work. Also, adds valus label. > COMPUTE TRINTotal = 0. > EXECUTE. > VARIABLE LABELS TRINTotal 'Raw score total for the > True Response > Inconsistency Validity Scale.'. > VALUE LABELS TRINTotal -9 'Missing responses, TRIN > score not computed.'. > > COMMENT Macro for scoring appropriatley (not > yielding a score for missing > data, or data that is not 1, 2, or does not adhere > to scoring guide). > DEFINE CalcTRINTotal (!POSITIONAL !TOKENS(1) > /!POSITIONAL > !TOKENS(2)) > DO IF (TRINTotal ~= -9). > IF (!1 = 1 & !2 = 1) TRINTotal = TRINTotal + 2. > IF (!1 = 1 & !2 = 2) TRINTotal = TRINTotal + 1. > IF (!1 = 2 & !2 = 1) TRINTotal = TRINTotal + 1. > IF (MISSING(!1) = 1) TRINTotal = -9. > IF (MISSING(!2) = 1) TRINTotal = -9. > END IF. > EXECUTE. > !ENDDEFINE. > > COMMENT Sends each variable pairing to CalcTRINTotal > macro for processing. > CalcTRINTotal snap6 snap69. > CalcTRINTotal snap19 snap217. > CalcTRINTotal snap24 snap96. > CalcTRINTotal snap25 snap105. > CalcTRINTotal snap31 snap181. > CalcTRINTotal snap37 snap41. > CalcTRINTotal snap45 snap183. > CalcTRINTotal snap47 snap127. > CalcTRINTotal snap49 snap215. > CalcTRINTotal snap57 snap82. > CalcTRINTotal snap84 snap95. > CalcTRINTotal snap98 snap161. > CalcTRINTotal snap109 snap194. > CalcTRINTotal snap129 snap200. > CalcTRINTotal snap133 snap224. > CalcTRINTotal snap140 snap218. > CalcTRINTotal snap141 snap153. > CalcTRINTotal snap167 snap226. > CalcTRINTotal snap190 snap206. > CalcTRINTotal snap212 snap225. > __________________________________________________________________________________________ Check out the New Yahoo! Mail - Fire up a more powerful email and get things done faster. (http://advision.webevents.yahoo.com/mailbeta) |
In reply to this post by Jeff Galecki
Hello Jeff,
Your macro is calling variable TRINTotal. The syntax before macro call creates the variable with command COMPUTE TRINTotal = 0. If the variable is not present in your datafile, macro canot be called without the preceding syntax. Could it be the reason of errors? Also as was already said the second parameter of the macro is defined !positional !tokens(2). The number 2 means two tokens (2 items of the macro parameter list) should be read, not the second item to read. Pls check the SPSS syntax reference, DEFINE command. regards Jindra > ------------ Původní zpráva ------------ > Od: Jeff Galecki <[hidden email]> > Předmět: SPSS Macro warnings. > Datum: 29.10.2006 19:06:48 > ---------------------------------------- > Hello all, I am using SPSS 15 (issue below also happens in 14) to run a > macro for scoring. When I attempt to run the macro and the sytax to feed > the variables into the macro at the same time I get multiple "Error #4285 > in column X. Text: macro" in the output. However, when I run the syntax > before the macro and including the macro, THEN run the syntax that feeds > the variables into the macro I get no errors. Also, under both ways of > running the sytax, the scoring appears to be the same. My questions is > this: Why do I get errors when I run the syntax for the macro and the > calls to that macro at the time, opposed to when I just run the macro > syntax, then seperatley run the calls to that macro? Is it just convention > that you "load/Run" the macro, then make calls to it only after it is > loaded? Thanks for any help on this. > > Jeff > > > COMMENT Creates TRINTotal variable (must have "something" in variable to > work. Also, adds valus label. > COMPUTE TRINTotal = 0. > EXECUTE. > VARIABLE LABELS TRINTotal 'Raw score total for the True Response > Inconsistency Validity Scale.'. > VALUE LABELS TRINTotal -9 'Missing responses, TRIN score not computed.'. > > COMMENT Macro for scoring appropriatley (not yielding a score for missing > data, or data that is not 1, 2, or does not adhere to scoring guide). > DEFINE CalcTRINTotal (!POSITIONAL !TOKENS(1) > /!POSITIONAL !TOKENS(2)) > DO IF (TRINTotal ~= -9). > IF (!1 = 1 & !2 = 1) TRINTotal = TRINTotal + 2. > IF (!1 = 1 & !2 = 2) TRINTotal = TRINTotal + 1. > IF (!1 = 2 & !2 = 1) TRINTotal = TRINTotal + 1. > IF (MISSING(!1) = 1) TRINTotal = -9. > IF (MISSING(!2) = 1) TRINTotal = -9. > END IF. > EXECUTE. > !ENDDEFINE. > > COMMENT Sends each variable pairing to CalcTRINTotal macro for processing. > CalcTRINTotal snap6 snap69. > CalcTRINTotal snap19 snap217. > CalcTRINTotal snap24 snap96. > CalcTRINTotal snap25 snap105. > CalcTRINTotal snap31 snap181. > CalcTRINTotal snap37 snap41. > CalcTRINTotal snap45 snap183. > CalcTRINTotal snap47 snap127. > CalcTRINTotal snap49 snap215. > CalcTRINTotal snap57 snap82. > CalcTRINTotal snap84 snap95. > CalcTRINTotal snap98 snap161. > CalcTRINTotal snap109 snap194. > CalcTRINTotal snap129 snap200. > CalcTRINTotal snap133 snap224. > CalcTRINTotal snap140 snap218. > CalcTRINTotal snap141 snap153. > CalcTRINTotal snap167 snap226. > CalcTRINTotal snap190 snap206. > CalcTRINTotal snap212 snap225. > > > |
Free forum by Nabble | Edit this page |