|
Dear all:
I have a macro that, among other tasks, writes (using WRITE OUTFILE) and runs the following syntax: IGRAPH /VIEWNAME='Bland-Altman LOA plot' /X1 = VAR(Mean) TYPE = SCALE /Y = VAR(Diff) TYPE = SCALE (MIN= -.4780 MAX= .3380) /COORDINATE = VERTICAL /X1LENGTH=3.0 /YLENGTH= 3.0 /REFLINE Diff .0405 /REFLINE Diff -.3303 /REFLINE Diff .4112 /TITLE=' Bland-Altman plot (with LOA)' /CAPTION=' Methods compared: esfPPR35a esfPPR35b' /SCATTER COINCIDENT = NONE. The MIN (-.4780), MAX (.3380) and 3 REFLINE (.0405, -.3303 & .4112) values are computed previously by a MATRIX code (stored as new variables named col1 to col5) and then passed as macro arguments to the WRITE OUFTILE code. Therefore, they depend on the variables being analyzed (they are not constant): STRING #var1 TO #var5 (A8). DO REPEAT A=#var1 TO #var5 /B=col1 TO col5. - COMPUTE A = STRING(B,F8.4). END REPEAT. DO IF $casenum EQ 1. - !LET !reflin1=!UNQUOTE(#var1). - !LET !reflin2=!UNQUOTE(#var2). - !LET !reflin3=!UNQUOTE(#var3). - !LET !ymin= !UNQUOTE(#var4). - !LET !ymax= !UNQUOTE(#var5). * Write Graph to syntax file *. WRITE OUTFILE 'c:\temp\LOAGraph.sps' /"IGRAPH" /" /VIEWNAME='Bland-Altman LOA plot'" /" /X1 = VAR(Mean) TYPE = SCALE" /" /Y = VAR(Diff) TYPE = SCALE (MIN="!ymin" MAX="!ymax")" /" /COORDINATE = VERTICAL" /" /X1LENGTH=3.0" /" /YLENGTH= 3.0" /" /REFLINE Diff "!reflin1 /" /REFLINE Diff "!reflin2 /" /REFLINE Diff "!reflin3 /" /TITLE=' Bland-Altman plot (with LOA)'" /" /CAPTION=' Methods compared: " !QUOTE(!1) "'" /" /SCATTER COINCIDENT = NONE.". END IF. This MACRO works OK as long as all 5 arguments (!reflin1 to !reflin3, !ymin & !ymax) have absolute values greater than 1. Unfortunately, as in the IGRAPH code shown above, if the arguments are smaller than 1, I get the following error message: "Warning: SSLex0105e: Invalid token, Line 1, Offset 214, ." and the graph is not drawn. If I manually tweak the IGRAPH code adding "0" before the decimal point: IGRAPH /VIEWNAME='Bland-Altman LOA plot' /X1 = VAR(Mean) TYPE = SCALE /Y = VAR(Diff) TYPE = SCALE (MIN= -0.4780 MAX= 0.3380) /COORDINATE = VERTICAL /X1LENGTH=3.0 /YLENGTH= 3.0 /REFLINE Diff 0.0405 /REFLINE Diff -0.3303 /REFLINE Diff 0.4112 /TITLE=' Bland-Altman plot (with LOA)' /CAPTION=' Methods compared: esfPPR35a esfPPR35b' /SCATTER COINCIDENT = NONE. The code works OK. But, what's the point in making a task automatic and having then to modify it manually at every run? I have 30 pairs of variables to analyze. Question: is there a way to force WRITE OUTFILE to add the "0" if the absolute value is smaller than 1(replace "-.4780" by "-0.4780)? Alternatively: Is there a way of forcing IGRAPH to accept -.4780 as a valid number? Thanks Marta -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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 |
|
Hi again:
Disregard my previous message. After perusing the syntax guide, I realized I could use E11.3 instead of F8.4: ... STRING #var1 TO #var5 (A12). <--- It was A8 before DO REPEAT A=#var1 TO #var5 /B=col1 TO col5. - COMPUTE A = STRING(B,E11.3). <---- It was F8.4 before END REPEAT. code goes on.... That solved the problem. The MACRO-generated IGRAPH command looks like this: IGRAPH /VIEWNAME='Bland-Altman LOA plot' /X1 = VAR(Mean) TYPE = SCALE /Y = VAR(Diff) TYPE = SCALE (MIN=-4.780E-001 MAX= 3.380E-001 ) /COORDINATE = VERTICAL /X1LENGTH=3.0 /YLENGTH= 3.0 /REFLINE Diff 4.047E-002 /REFLINE Diff -3.303E-001 /REFLINE Diff 4.112E-001 /TITLE=' Bland-Altman plot (with LOA)' /CAPTION=' Methods compared: esfPPR35a esfPPR35b' /SCATTER COINCIDENT = NONE. The "missing leading 0" problem is now history. Marta -------------------------------------------------- I wrote: > I have a macro that, among other tasks, writes (using WRITE OUTFILE) > and runs the following syntax: > > IGRAPH > /VIEWNAME='Bland-Altman LOA plot' > /X1 = VAR(Mean) TYPE = SCALE > /Y = VAR(Diff) TYPE = SCALE (MIN= -.4780 MAX= .3380) > /COORDINATE = VERTICAL > /X1LENGTH=3.0 > /YLENGTH= 3.0 > /REFLINE Diff .0405 > /REFLINE Diff -.3303 > /REFLINE Diff .4112 > /TITLE=' Bland-Altman plot (with LOA)' > /CAPTION=' Methods compared: esfPPR35a esfPPR35b' > /SCATTER COINCIDENT = NONE. > > The MIN (-.4780), MAX (.3380) and 3 REFLINE (.0405, -.3303 & .4112) > values are computed previously by a MATRIX code (stored as new > variables named col1 to col5) and then passed as macro arguments to > the WRITE OUFTILE code. Therefore, they depend on the variables being > analyzed (they are not constant): > > STRING #var1 TO #var5 (A8). > DO REPEAT A=#var1 TO #var5 /B=col1 TO col5. > - COMPUTE A = STRING(B,F8.4). > END REPEAT. > DO IF $casenum EQ 1. > - !LET !reflin1=!UNQUOTE(#var1). > - !LET !reflin2=!UNQUOTE(#var2). > - !LET !reflin3=!UNQUOTE(#var3). > - !LET !ymin= !UNQUOTE(#var4). > - !LET !ymax= !UNQUOTE(#var5). > * Write Graph to syntax file *. > WRITE OUTFILE 'c:\temp\LOAGraph.sps' > /"IGRAPH" > /" /VIEWNAME='Bland-Altman LOA plot'" > /" /X1 = VAR(Mean) TYPE = SCALE" > /" /Y = VAR(Diff) TYPE = SCALE (MIN="!ymin" MAX="!ymax")" > /" /COORDINATE = VERTICAL" > /" /X1LENGTH=3.0" > /" /YLENGTH= 3.0" > /" /REFLINE Diff "!reflin1 > /" /REFLINE Diff "!reflin2 > /" /REFLINE Diff "!reflin3 > /" /TITLE=' Bland-Altman plot (with LOA)'" > /" /CAPTION=' Methods compared: " !QUOTE(!1) "'" > /" /SCATTER COINCIDENT = NONE.". > END IF. > > This MACRO works OK as long as all 5 arguments (!reflin1 to !reflin3, > !ymin & !ymax) have absolute values greater than 1. Unfortunately, as > in the IGRAPH code shown above, if the arguments are smaller than 1, I > get the following error message: "Warning: SSLex0105e: Invalid token, > Line 1, Offset 214, ." and the graph is not drawn. If I manually tweak > the IGRAPH code adding "0" before the decimal point: > > IGRAPH > /VIEWNAME='Bland-Altman LOA plot' > /X1 = VAR(Mean) TYPE = SCALE > /Y = VAR(Diff) TYPE = SCALE (MIN= -0.4780 MAX= 0.3380) > /COORDINATE = VERTICAL > /X1LENGTH=3.0 > /YLENGTH= 3.0 > /REFLINE Diff 0.0405 > /REFLINE Diff -0.3303 > /REFLINE Diff 0.4112 > /TITLE=' Bland-Altman plot (with LOA)' > /CAPTION=' Methods compared: esfPPR35a esfPPR35b' > /SCATTER COINCIDENT = NONE. > > The code works OK. But, what's the point in making a task automatic > and having then to modify it manually at every run? I have 30 pairs of > variables to analyze. > > Question: is there a way to force WRITE OUTFILE to add the "0" if the > absolute value is smaller than 1(replace "-.4780" by "-0.4780)? > Alternatively: Is there a way of forcing IGRAPH to accept -.4780 as a > valid number? -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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 |
