• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (2)

1 Kiza commented Permalink

Hi Jon,

 
I am having trouble making this below code to work, if you don't mine can you tell me what that i am doing wrong.
 
Original syntax:-
 
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=xaxis MEAN(yaxis)[name="MEAN_yaxis"] legendA
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: xaxis=col(source(s), name("xaxis"), unit.category())
DATA: MEAN_yaxis=col(source(s), name("MEAN_yaxis"))
DATA: legendA=col(source(s), name("legendA"), unit.category())
GUIDE: axis(dim(1), label("Rolling Quarters to April 2011 "))
GUIDE: axis(dim(2), label("Mean "))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Product"))
GUIDE: text.title(label("Rolling Quarter Share of Voice (%)"))
GUIDE: text.subtitle(label(@REPORT))
GUIDE: text.footnote(label("\n\n\nCopyright IMS Health 2011"))
SCALE: linear(dim(2), include(0))
ELEMENT: line(position(xaxis*MEAN_yaxis), color.interior(legendA), missing.wings())
END GPL.
 
 
converted to python code:-
 
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=xaxis MEAN(yaxis)[name="MEAN_yaxis"] legendA
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: xaxis=col(source(s), name("xaxis"), unit.category())
DATA: MEAN_yaxis=col(source(s), name("MEAN_yaxis"))
DATA: legendA=col(source(s), name("legendA"), unit.category())
GUIDE: axis(dim(1), label("Rolling Quarters to April 2011 "))
GUIDE: axis(dim(2), label("Mean "))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Product"))
GUIDE: text.title(label("Rolling Quarter Share of Voice (%)"))
GUIDE: text.subtitle(label(@REPORT))
GUIDE: text.footnote(label("\n\n\nCopyright IMS Health 2011"))
SCALE: linear(dim(2), include(0))
ELEMENT: line(position(xaxis*MEAN_yaxis), color.interior(legendA), missing.wings())
END GPL.
 
hope to hear from you.
 
Regards,
Kiran Kollipara
IBM SPSS

2 Kiza commented Permalink

I am extremely sorru Jon,please ignore my last comment, I have pasted wrong code on python part.

 
here is proper one
 
Original syntax:-
 
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=xaxis MEAN(yaxis)[name="MEAN_yaxis"] legendA
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: xaxis=col(source(s), name("xaxis"), unit.category())
DATA: MEAN_yaxis=col(source(s), name("MEAN_yaxis"))
DATA: legendA=col(source(s), name("legendA"), unit.category())
GUIDE: axis(dim(1), label("Rolling Quarters to April 2011 "))
GUIDE: axis(dim(2), label("Mean "))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Product"))
GUIDE: text.title(label("Rolling Quarter Share of Voice (%)"))
GUIDE: text.subtitle(label(@REPORT))
GUIDE: text.footnote(label("\n\n\nCopyright IMS Health 2011"))
SCALE: linear(dim(2), include(0))
ELEMENT: line(position(xaxis*MEAN_yaxis), color.interior(legendA), missing.wings())
END GPL.
 
 
converted to python code:-
 
 
BEGIN PROGRAM PYTHON.
import spss
sMax = """100"""
iMax = 70
 
sCmd ="""GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=xaxis MEAN(yaxis)[name="MEAN_yaxis"] legendA
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE TEMPLATE ="sLooksPath\C02.sgt".
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: xaxis=col(source(s), name("xaxis"), unit.category())
DATA: MEAN_yaxis=col(source(s), name("MEAN_yaxis"))
DATA: legendA=col(source(s), name("legendA"), unit.category())
GUIDE: axis(dim(1), label("Rolling Quarters to April 2011 "))
GUIDE: axis(dim(2), label("Mean"))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Product"))
GUIDE: text.title(label("Rolling Quarter Share of Voice (%)"))
GUIDE: text.subtitle(label("MISSING INFO"))
GUIDE: text.footnote(label("Copyright IMS Health 2011 %(sMax)s"))
SCALE: linear(dim(2), include(0),max("%(iMax)s"))
ELEMENT: line(position(xaxis*MEAN_yaxis), color.interior(legendA), missing.wings())
END GPL.""" % locals()
 
spss.Submit(sCmd)
 
END PROGRAM.
 
Hope to hear form you
 
Regards,
Kiran

Add a Comment Add a Comment