|
Hello,
I am using SPSS 22 on Windows 7. I want to make a scatter plot with convex hulls around groups using the code below. I am getting two errors that I think are related. The first is "An inline graph specification was expected but not found" and the second is "This command is only valid immediately following the GGRAPH procedure. But, I really do not see what is wrong with the code... Many thanks, Matt GET FILE='C:\Users\ms871\Dropbox\CURRENT_PROJECTS\LOMEKWI\Lower_teeth_2.sav'. GGRAPH /GRAPHDATASET NAME="Lower_teeth_2" VARIABLES=MD BL /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Lower_teeth_2")) DATA: salbegin=col(source(s), name("MD")) DATA: salary=col(source(s), name("BL")) DATA: gender=col(source(s), name("Taxon3"), unit.category()) GUIDE: axis(dim(1), label("MD")) GUIDE: axis(dim(2), label("BL")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Taxon3")) GUIDE: legend(aesthetic(aesthetic.color.interior), null()) ELEMENT: point(position(MD*BL), color.exterior(Taxon3)) ELEMENT: edge(position(link.hull(MD*BL)), color.interior(Taxon3)) END GPL. |
|
The error message is maybe a bit of a red herring, because there is a bunch wrong with your GGRAPH call:
- on the GRAPHDATASET subcommand on the VARIABLES list you do not include Taxon3 - on the DATA subcommands you define MD, BL, and Taxon3 to be named salbegin, salary, and gender respectively - you then call your original variables names in the ELEMENT statements Below is a quick example showing the corrected GGRAPH code. ************************************************. DATA LIST FREE / MD BL Taxon3 (3F1.0). BEGIN DATA 1 1 1 1 2 1 2 2 1 2 1 1 3 2 2 3 3 2 4 3 2 4 2 2 END DATA. GGRAPH /GRAPHDATASET NAME="Lower_teeth_2" VARIABLES=MD BL Taxon3 /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Lower_teeth_2")) DATA: MD=col(source(s), name("MD")) DATA: BL=col(source(s), name("BL")) DATA: Taxon3=col(source(s), name("Taxon3"), unit.category()) GUIDE: axis(dim(1), label("MD")) GUIDE: axis(dim(2), label("BL")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Taxon3")) GUIDE: legend(aesthetic(aesthetic.color.interior), null()) ELEMENT: point(position(MD*BL), color.exterior(Taxon3)) ELEMENT: edge(position(link.hull(MD*BL)), color.interior(Taxon3)) END GPL. ************************************************. As far as the error message, I've gotten some strange behavior before when the dataset does not have a name, which is what happens when you just call GET FILE but then don't follow it up with a DATASET NAME command. That is my best guess. See below for one example: ************************************************. DATA LIST FREE / MD BL Taxon3 3(3F1.0). BEGIN DATA 1 1 1 1 2 1 2 2 1 2 1 1 3 2 2 3 3 2 4 3 2 4 2 2 END DATA. GGRAPH /GRAPHDATASET NAME="Lower_teeth_2" VARIABLES=MD BL Taxon3 /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Lower_teeth_2")) DATA: MD=col(source(s), name("MD")) DATA: BL=col(source(s), name("BL")) DATA: Taxon3=col(source(s), name("Taxon3"), unit.category()) GUIDE: axis(dim(1), label("MD")) GUIDE: axis(dim(2), label("BL")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Taxon3")) GUIDE: legend(aesthetic(aesthetic.color.interior), null()) ELEMENT: point(position(MD*BL), color.exterior(Taxon3)) ELEMENT: edge(position(link.hull(MD*BL)), color.interior(Taxon3)) END GPL. ************************************************. Which produces these set of error codes around the GGRAPH call (among others after the DATA LIST line). This is for V22. >Error # 105. Command name: GGRAPH >This command is not valid before a working file has been defined. >Execution of this command stops. /GRAPHDATASET NAME="Lower_teeth_2" VARIABLES=MD BL Taxon3 /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Lower_teeth_2")) DATA: MD=col(source(s), name("MD")) DATA: BL=col(source(s), name("BL")) DATA: Taxon3=col(source(s), name("Taxon3"), unit.category()) GUIDE: axis(dim(1), label("MD")) GUIDE: axis(dim(2), label("BL")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Taxon3")) GUIDE: legend(aesthetic(aesthetic.color.interior), null()) ELEMENT: point(position(MD*BL), color.exterior(Taxon3)) ELEMENT: edge(position(link.hull(MD*BL)), color.interior(Taxon3)) END GPL. >Error # 99. Command name: BEGIN GPL >This command is only valid immediately following the GGRAPH procedure. >Execution of this command stops. |
|
Many thanks Andy! After making the corrections you pointed out it works :)
|
| Free forum by Nabble | Edit this page |
