Login  Register

Re: What is wrong in this syntax?

Posted by Jon K Peck on Aug 23, 2011; 6:00pm
URL: http://spssx-discussion.165.s1.nabble.com/fixed-effect-with-ancova-tp4713723p4727681.html

You can't any anything between the GGRAPH command and the BEGIN GPL line.  Delete the comment and blank lines, and you should be fine.

Jon Peck (no "h")
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Eins Bernardo <[hidden email]>
To:        [hidden email]
Date:        08/23/2011 03:54 AM
Subject:        [SPSSX-L] What is wrong in this syntax?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I tried to run the syntax below using version 18 to generate Forest Plot.  Unfortunately, it does not work.  A warning appeared on the screen as follows:
 
Warnings
An inline graph specification was expected but not found.
Execution of this command stops.

 
I appreciate any help.
 Eins

* Sample dataset (processed data )*.
DATA LIST LIST/ trial(F4) year(A5) study(A10) measure cilow ciup percwi(4 F8.3).
BEGIN DATA
1 "1989" "Hodnett  " .502 .262  .962   4.940
2 "1991" "Kennell  " .352 .216  .575   8.694
3 "1992" "Bréart-Fr" .785 .483 1.276   8.878
4 "1992" "Bréart-Bg" .811 .653 1.007  44.598
5 "1997" "Gagnon   " .867 .573 1.311  12.237
6 "1998" "Langer   " .280 .203  .384  20.654
7 "    " "Total    " .594 .514  .687 100.000
END DATA.

*/ Assuming you have SPSS 14:

SORT CASES BY trial(D).
STRING YearAndStudy(A30).
COMPUTE YearAndStudy=CONCAT(RTRIM(year)," ",study).
COMPUTE RefLine=1.

GGRAPH
 /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow measure percwi RefLine
 MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.

* If the effect you are measuring is OR or RR, then this syntax can
do the task *.

BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA:   YearAndStudy=col(source(s),   name("YearAndStudy"), unit.category())
DATA:   ciup=col(source(s),    name("ciup"))
DATA:   cilow=col(source(s),   name("cilow"))
DATA:   measure=col(source(s), name("measure"))
DATA:   percwi=col(source(s),  name("percwi"))
DATA:   RefLine=col(source(s), name("RefLine"))
COORD:  transpose(rect(dim(1,2), transpose()))
GUIDE:  axis(dim(2), label(" Favours treatment                 Favours Control"))
SCALE:  cat(dim(1))
SCALE:  log(dim(2))
ELEMENT: interval(position(region.spread.range(YearAndStudy*(cilow+ciup))),
 shape(shape.line), color(color.black))
ELEMENT: point(position(YearAndStudy*measure), shape(shape.square),
 size(percwi), color.interior(color.black))
ELEMENT: line(position(YearAndStudy*RefLine), shape(shape.line))
END GPL.