|
I wish to simply have two histograms built. They do not need to be
combined in any way. One for the first variable called pctups. The second for pctfed. I tried declaring the GGRAPH statement once but that does not work. Can anyone suggest ways to bring the code down in size? As well- I am going to double-click on the vertical percentage scale after I run this to make it so they are both the same. Can anyone offer any suggestions of the code to automatically set it? Thank you. Zachary GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctups=col(source(s), name("pctups"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr1/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctfed=col(source(s), name("pctfed"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr2/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. |
|
Do you want two histograms within the same chart or two separate charts?
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Feinstein, Zachary Sent: Friday, August 17, 2007 11:35 AM To: [hidden email] Subject: Ways to Shorten GGRAPH and GPL Code I wish to simply have two histograms built. They do not need to be combined in any way. One for the first variable called pctups. The second for pctfed. I tried declaring the GGRAPH statement once but that does not work. Can anyone suggest ways to bring the code down in size? As well- I am going to double-click on the vertical percentage scale after I run this to make it so they are both the same. Can anyone offer any suggestions of the code to automatically set it? Thank you. Zachary GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctups=col(source(s), name("pctups"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr1/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctfed=col(source(s), name("pctfed"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr2/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. |
|
Two separate charts, please.
Would not mind seeing the code for all in one too, if that is easily available as well. Thanks. Zachary -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Friday, August 17, 2007 1:20 PM To: Feinstein, Zachary; [hidden email] Subject: RE: Ways to Shorten GGRAPH and GPL Code Do you want two histograms within the same chart or two separate charts? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Feinstein, Zachary Sent: Friday, August 17, 2007 11:35 AM To: [hidden email] Subject: Ways to Shorten GGRAPH and GPL Code I wish to simply have two histograms built. They do not need to be combined in any way. One for the first variable called pctups. The second for pctfed. I tried declaring the GGRAPH statement once but that does not work. Can anyone suggest ways to bring the code down in size? As well- I am going to double-click on the vertical percentage scale after I run this to make it so they are both the same. Can anyone offer any suggestions of the code to automatically set it? Thank you. Zachary GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctups=col(source(s), name("pctups"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr1/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctfed=col(source(s), name("pctfed"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr2/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. |
|
The code to produce to separate charts in one invocation of ggraph is much
longer and requires a lot more tweaking then two separate charts to produce what you want. I don't recommend it. If you're looking for simple code, GPL is not going to be the solution. Here's an example that places the histograms side-by-side with a shared Y axis so no tweaking is required to make them the same. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salbegin=col(source(s), name("salbegin")) DATA: salary=col(source(s), name("salary")) GUIDE: axis(dim(2), label("Percentage")) ELEMENT: interval(position(summary.percent.count(bin.rect(salbegin/"Beginning Salary" + salary/"Current Salary"))), shape.interior(shape.square)) END GPL. This uses the employee data.sav sample file. -----Original Message----- From: Feinstein, Zachary [mailto:[hidden email]] Sent: Friday, August 17, 2007 12:30 PM To: ViAnn Beadle; [hidden email] Subject: RE: Ways to Shorten GGRAPH and GPL Code Two separate charts, please. Would not mind seeing the code for all in one too, if that is easily available as well. Thanks. Zachary -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Friday, August 17, 2007 1:20 PM To: Feinstein, Zachary; [hidden email] Subject: RE: Ways to Shorten GGRAPH and GPL Code Do you want two histograms within the same chart or two separate charts? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Feinstein, Zachary Sent: Friday, August 17, 2007 11:35 AM To: [hidden email] Subject: Ways to Shorten GGRAPH and GPL Code I wish to simply have two histograms built. They do not need to be combined in any way. One for the first variable called pctups. The second for pctfed. I tried declaring the GGRAPH statement once but that does not work. Can anyone suggest ways to bring the code down in size? As well- I am going to double-click on the vertical percentage scale after I run this to make it so they are both the same. Can anyone offer any suggestions of the code to automatically set it? Thank you. Zachary GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctups=col(source(s), name("pctups"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr1/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=pctups pctfed [LEVEL=NOMINAL] COUNT()[name="COUNT"] MISSING=VARIABLEWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: pctfed=col(source(s), name("pctfed"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("S6. % shpmts to carr2/mo")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(pctups*COUNT, base.all(acrossPanels()))), shape.interior(shape.square)) END GPL. |
| Free forum by Nabble | Edit this page |
