Hi,
I will refer to a common file EMPLOYEE DATA.SAV, in which I added another variable "firstjobcat" that has the same values as "jobcat" but shows what was the category of the first job that an employee took in the past. First I made a stacked bar showing for each (current) employment category percentage of educational level by using: * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()[name= "COUNT"] educ MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: educ=col(source(s), name("educ"), unit.category()) GUIDE: axis(dim(1), label("Employment Category")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Educational ", "Level (years)")) SCALE: cat(dim(1), include("1", "2", "3")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("8", "12", "14", "15", "16", "17", "18", "19", "20", "21")) ELEMENT: interval.stack(position(summary.percent(jobcat*COUNT, base.coordinate(dim(1)) )), color.interior(educ), shape.interior(shape.square)) END GPL. I can do the same for the new >firstjobcat< just changing the variable name in GGRAPH and GPL. What I want is to create one graph showing for each category results of BOTH variables side by side so I can have a visual comparison. Is it possible and how? Do I have to add "firstjobcat" in the GGRAPH? Thank you Regards Mitja |
Here's another case in which you need to do the counting within GPL itself.
GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat jobcat2 educ MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: jobcat2=col(source(s), name("jobcat2"), unit.category()) DATA: educ=col(source(s), name("educ"), unit.category()) GUIDE: axis(dim(1), label("Employment Category")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Educational ", "Level (years)")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("8", "12", "14", "15", "16", "17", "18", "19", "20", "21")) ELEMENT: interval.stack(position(summary.percent.count(("jobcat" * jobcat)+("jobcat2" * jobcat2), base.coordinate(dim(1)) )), color.interior(educ), shape.interior(shape.square)) END GPL. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of mitja decman Sent: Thursday, April 19, 2007 5:14 AM To: [hidden email] Subject: GGRAPH - two simmilar variables in one stacked bar - GPL, clustered, paneled, grouped, faceted ? Hi, I will refer to a common file EMPLOYEE DATA.SAV, in which I added another variable "firstjobcat" that has the same values as "jobcat" but shows what was the category of the first job that an employee took in the past. First I made a stacked bar showing for each (current) employment category percentage of educational level by using: * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()[name= "COUNT"] educ MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: educ=col(source(s), name("educ"), unit.category()) GUIDE: axis(dim(1), label("Employment Category")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Educational ", "Level (years)")) SCALE: cat(dim(1), include("1", "2", "3")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("8", "12", "14", "15", "16", "17", "18", "19", "20", "21")) ELEMENT: interval.stack(position(summary.percent(jobcat*COUNT, base.coordinate(dim(1)) )), color.interior(educ), shape.interior(shape.square)) END GPL. I can do the same for the new >firstjobcat< just changing the variable name in GGRAPH and GPL. What I want is to create one graph showing for each category results of BOTH variables side by side so I can have a visual comparison. Is it possible and how? Do I have to add "firstjobcat" in the GGRAPH? Thank you Regards Mitja |
In reply to this post by mitja decman
Well,
thanks but.... I need a Graph with comparison of all 3 employment categories of jobtype - so 2 columns for Clerical, 2 for Custodial and 2 for Manager. Alltogether 6 columnt in 1 graph. How? Regrads Mitja On Thu, 19 Apr 2007 07:59:54 -0500, Beadle, ViAnn <[hidden email]> wrote: >Here's another case in which you need to do the counting within GPL itself. > >GGRAPH > /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat jobcat2 educ MISSING=LISTWISE REPORTMISSING=NO > /GRAPHSPEC SOURCE=INLINE. >BEGIN GPL > SOURCE: s=userSource(id("graphdataset")) > DATA: jobcat=col(source(s), name("jobcat"), unit.category()) > DATA: jobcat2=col(source(s), name("jobcat2"), unit.category()) > DATA: educ=col(source(s), name("educ"), unit.category()) > GUIDE: axis(dim(1), label("Employment Category")) > GUIDE: axis(dim(2), label("Percent")) > GUIDE: legend(aesthetic(aesthetic.color.interior), label("Educational ", > "Level (years)")) > SCALE: linear(dim(2), include(0)) > SCALE: cat(aesthetic(aesthetic.color.interior), include("8", "12", "14", > "15", "16", "17", "18", "19", "20", "21")) > ELEMENT: interval.stack(position(summary.percent.count(("jobcat" * >base.coordinate(dim(1)) >)), color.interior(educ), shape.interior(shape.square)) >END GPL. > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of mitja decman >Sent: Thursday, April 19, 2007 5:14 AM >To: [hidden email] >Subject: GGRAPH - two simmilar variables in one stacked bar - GPL, clustered, paneled, grouped, faceted ? > >Hi, > > > >I will refer to a common file EMPLOYEE DATA.SAV, in which I added >another variable "firstjobcat" that has the same values as "jobcat" but >shows what was the category of the first job that an employee took in >the past. First I made a stacked bar showing for each (current) >employment category percentage of educational level by using: > >* Chart Builder. > >GGRAPH > > /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()[name= > > "COUNT"] educ MISSING=LISTWISE REPORTMISSING=NO > > /GRAPHSPEC SOURCE=INLINE. > >BEGIN GPL > > SOURCE: s=userSource(id("graphdataset")) > > DATA: jobcat=col(source(s), name("jobcat"), unit.category()) > > DATA: COUNT=col(source(s), name("COUNT")) > > DATA: educ=col(source(s), name("educ"), unit.category()) > > GUIDE: axis(dim(1), label("Employment Category")) > > GUIDE: axis(dim(2), label("Percent")) > > GUIDE: legend(aesthetic(aesthetic.color.interior), label("Educational >", > > "Level (years)")) > > SCALE: cat(dim(1), include("1", "2", "3")) > > SCALE: linear(dim(2), include(0)) > > SCALE: cat(aesthetic(aesthetic.color.interior), include("8", "12", >"14", > > "15", "16", "17", "18", "19", "20", "21")) > > ELEMENT: interval.stack(position(summary.percent(jobcat*COUNT, >base.coordinate(dim(1)) > >)), color.interior(educ), shape.interior(shape.square)) > >END GPL. > > > >I can do the same for the new >firstjobcat< just changing the variable >name in GGRAPH and GPL. > >What I want is to create one graph showing for each category results of >BOTH variables side by side so I can have a visual comparison. > >Is it possible and how? Do I have to add "firstjobcat" in the GGRAPH? > > > >Thank you > >Regards > >Mitja |
Free forum by Nabble | Edit this page |