|
I have data like this ID Year Rate
The format for Rate is F11.5. When I look at the data in the data editor, it displays as above. When I run EXPLORE, it output displays as above. However, when I try to graph the data, the values on the Y axis are in Scientific Notation. Here's the syntax that I'm using: GRAPH
I get the same result using GGRAPH. How can I get the Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3? TIA Pat |
|
You’re getting scientific notation on the y axis because
there is not enough room to display the results with a format of F11.5. Set the
format of rate to something like F6.5 and you’ll get what you want. If
you really need that format for some other data not shown here, you can set the
format via a chart template and IIRC, via a function in GPL. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU) I have data like
this ID Year Rate
The format for Rate
is F11.5. When I look at the
data in the data editor, it displays as above. When I run EXPLORE,
it output displays as above. However, when I try
to graph the data, the values on the Y axis are in Scientific Notation. Here's the syntax
that I'm using: GRAPH I get the same
result using GGRAPH. How can I get the
Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3? TIA Pat |
|
Thanks, ViAnn. Although changing the format didn't
help, I was able to modify the GPL syntax by adding the max function and it
worked fine.
Now, I've added another column to the data so that for each
year for each ID I have the rate for the ID and the overall rate, i.e., the rate
across all the IDs:
ID Year
Rate OverallRate
I'd like to create a multiple-line graph for each ID with
the Rate for the ID and the OverallRate as separate lines. I can do this
in Graph
SPLIT FILE SEPARATE BY ID.
GRAPH
/LINE(MULTIPLE)=VALUE(Rate OverallRate) BY Year. But for the life of me, I can't figure out how to do it
with GPL.
Any help would be appreciated.
From: ViAnn Beadle [mailto:[hidden email]] Sent: August 5, 2009 4:46 PM To: Cleland, Patricia (EDU); [hidden email] Subject: RE: Data with very small values displays as scientific format in charts You’re
getting scientific notation on the y axis because there is not enough room to
display the results with a format of F11.5. Set the format of rate to something
like F6.5 and you’ll get what you want. If you really need that format for some
other data not shown here, you can set the format via a chart template and IIRC,
via a function in GPL. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Cleland, Patricia
(EDU) I have data like
this ID Year Rate
The format for Rate
is F11.5. When I look at the
data in the data editor, it displays as above. When I run EXPLORE,
it output displays as above. However, when I try
to graph the data, the values on the Y axis are in Scientific Notation.
Here's the syntax
that I'm using: GRAPH
I get the same
result using GGRAPH. How can I get the
Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3?
TIA
Pat
|
|
When you want multiple variables on any axis in GPL, you either
must use multiple element statements, use the blend operator (‘+’),
or transform the data using VARSTOCASES outside of or the varstocases function
within GPL. The simplest thing usually is to use multiple elements especially
if no summary functions (e.g., mean) are to be applied. Here’s an example with completely made up data in an input
program. Y1 and y2 correspond to your two y variables and splitvar corresponds
to your ID variable. input program. loop #i=1 to 100. compute y1=NORMAL(1). compute y2=NORMAL(1). compute splitvar=rnd(uniform(4)). compute year=rnd(uniform(10)). end case. end loop. end file. end input program. execute. sort cases by splitvar. split file separate by splitvar. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset"
VARIABLES=year y1 y2 MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: year=col(source(s), name("year")) DATA: y1=col(source(s), name("y1")) DATA: y2=col(source(s), name("y2")) GUIDE: axis(dim(1), label("year")) GUIDE: axis(dim(2), label("y1 and y2")) ELEMENT: line(position(year*y1), missing.wings(),
color("Y1")) ELEMENT: line(position(year*y2), missing.wings(),
color("Y2")) END GPL. I use SPLIT FILE to get the multiple charts as you did in your
example. With a few number of categories I would just create panels with the ID
variable as the paneling variable. The first ELEMENT plots the first variable
and the second ELEMENT overlays the plot of the second variable. I use the
color function with a constant which creates different colors for y1 and y2.
You don’t have to have an axis label on y. From: Cleland, Patricia
(EDU) [mailto:[hidden email]] Thanks, ViAnn. Although changing the format didn't help, I
was able to modify the GPL syntax by adding the max function and it worked
fine. Now, I've added another column to the data so that for each year
for each ID I have the rate for the ID and the overall rate, i.e., the rate
across all the IDs: ID Year Rate OverallRate I'd like to create a multiple-line graph for each ID with the Rate
for the ID and the OverallRate as separate lines. I can do this in Graph SPLIT FILE SEPARATE BY ID. GRAPH But for the life of me, I can't figure out how to do it with
GPL. Any help would be appreciated.
From: ViAnn Beadle [mailto:[hidden email]] You’re getting scientific notation on the y axis because
there is not enough room to display the results with a format of F11.5. Set the
format of rate to something like F6.5 and you’ll get what you want. If
you really need that format for some other data not shown here, you can set the
format via a chart template and IIRC, via a function in GPL. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU) I have data like
this ID Year Rate
The format for Rate
is F11.5. When I look at the
data in the data editor, it displays as above. When I run EXPLORE,
it output displays as above. However, when I try
to graph the data, the values on the Y axis are in Scientific Notation. Here's the syntax
that I'm using: GRAPH I get the same
result using GGRAPH. How can I get the
Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3? TIA Pat |
|
Thanks, ViAnn. Works like a charm.
Does anyone know of a good intro to using GPL or
on-line course? Something at the level of the for Dummies or Idiot's Guide
books.
From: ViAnn Beadle [mailto:[hidden email]] Sent: August 6, 2009 5:48 PM To: Cleland, Patricia (EDU); [hidden email] Subject: RE: Data with very small values displays as scientific format in charts When
you want multiple variables on any axis in GPL, you either must use multiple
element statements, use the blend operator (‘+’), or transform the data using
VARSTOCASES outside of or the varstocases function within GPL. The simplest
thing usually is to use multiple elements especially if no summary functions
(e.g., mean) are to be applied. Here’s
an example with completely made up data in an input program. Y1 and y2
correspond to your two y variables and splitvar corresponds to your ID
variable. input
program. loop
#i=1 to 100. compute
y1=NORMAL(1). compute
y2=NORMAL(1). compute
splitvar=rnd(uniform(4)). compute
year=rnd(uniform(10)). end
case. end
loop. end
file. end
input program. execute. sort
cases by splitvar. split
file separate by splitvar. *
Chart Builder. GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=year y1 y2 MISSING=LISTWISE
REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE. BEGIN
GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: year=col(source(s), name("year"))
DATA: y1=col(source(s), name("y1"))
DATA: y2=col(source(s), name("y2"))
GUIDE: axis(dim(1), label("year"))
GUIDE: axis(dim(2), label("y1 and y2"))
ELEMENT: line(position(year*y1), missing.wings(),
color("Y1"))
ELEMENT: line(position(year*y2), missing.wings(),
color("Y2")) END
GPL. I
use SPLIT FILE to get the multiple charts as you did in your example. With a few
number of categories I would just create panels with the ID variable as the
paneling variable. The first ELEMENT plots the first variable and the second
ELEMENT overlays the plot of the second variable. I use the color function with
a constant which creates different colors for y1 and y2. You don’t have to have
an axis label on y. From: Cleland, Patricia
(EDU) [mailto:[hidden email]] Thanks,
ViAnn. Although changing the format didn't help, I was able to modify the
GPL syntax by adding the max function and it worked fine.
Now,
I've added another column to the data so that for each year for each ID I have
the rate for the ID and the overall rate, i.e., the rate across all the
IDs: ID Year
Rate
OverallRate I'd like
to create a multiple-line graph for each ID with the Rate for the ID and the
OverallRate as separate lines. I can do this in
Graph SPLIT
FILE SEPARATE BY ID. GRAPH
But for
the life of me, I can't figure out how to do it with GPL.
Any help
would be appreciated.
From: ViAnn Beadle
[mailto:[hidden email]] You’re
getting scientific notation on the y axis because there is not enough room to
display the results with a format of F11.5. Set the format of rate to something
like F6.5 and you’ll get what you want. If you really need that format for some
other data not shown here, you can set the format via a chart template and IIRC,
via a function in GPL. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Cleland, Patricia
(EDU) I have data like
this ID Year Rate
The format for Rate
is F11.5. When I look at the
data in the data editor, it displays as above. When I run EXPLORE,
it output displays as above. However, when I try
to graph the data, the values on the Y axis are in Scientific Notation.
Here's the syntax
that I'm using: GRAPH
I get the same
result using GGRAPH. How can I get the
Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3?
TIA
Pat
|
|
I actually wrote a set of course materials for SPSS Inc on
GPL. I’m not sure what the status of the course is. From: Cleland, Patricia
(EDU) [mailto:[hidden email]] Thanks, ViAnn. Works like a charm. Does anyone know of a good intro to using GPL or on-line
course? Something at the level of the for Dummies or Idiot's Guide books. From: ViAnn Beadle [mailto:[hidden email]] When you want multiple variables on any axis in GPL, you either
must use multiple element statements, use the blend operator (‘+’),
or transform the data using VARSTOCASES outside of or the varstocases function
within GPL. The simplest thing usually is to use multiple elements especially
if no summary functions (e.g., mean) are to be applied. Here’s an example with completely made up data in an input
program. Y1 and y2 correspond to your two y variables and splitvar corresponds
to your ID variable. input program. loop #i=1 to 100. compute y1=NORMAL(1). compute y2=NORMAL(1). compute splitvar=rnd(uniform(4)). compute year=rnd(uniform(10)). end case. end loop. end file. end input program. execute. sort cases by splitvar. split file separate by splitvar. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset"
VARIABLES=year y1 y2 MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: year=col(source(s), name("year")) DATA: y1=col(source(s), name("y1")) DATA: y2=col(source(s), name("y2")) GUIDE: axis(dim(1), label("year")) GUIDE: axis(dim(2), label("y1 and y2")) ELEMENT: line(position(year*y1), missing.wings(),
color("Y1")) ELEMENT: line(position(year*y2), missing.wings(),
color("Y2")) END GPL. I use SPLIT FILE to get the multiple charts as you did in your
example. With a few number of categories I would just create panels with the ID
variable as the paneling variable. The first ELEMENT plots the first variable
and the second ELEMENT overlays the plot of the second variable. I use the
color function with a constant which creates different colors for y1 and y2.
You don’t have to have an axis label on y. From: Cleland, Patricia
(EDU) [mailto:[hidden email]] Thanks, ViAnn. Although changing the format didn't help, I
was able to modify the GPL syntax by adding the max function and it worked
fine. Now, I've added another column to the data so that for each year
for each ID I have the rate for the ID and the overall rate, i.e., the rate
across all the IDs: ID Year Rate OverallRate I'd like to create a multiple-line graph for each ID with the Rate
for the ID and the OverallRate as separate lines. I can do this in Graph SPLIT FILE SEPARATE BY ID. GRAPH But for the life of me, I can't figure out how to do it with
GPL. Any help would be appreciated.
From: ViAnn Beadle [mailto:[hidden email]] You’re getting scientific notation on the y axis because
there is not enough room to display the results with a format of F11.5. Set the
format of rate to something like F6.5 and you’ll get what you want. If
you really need that format for some other data not shown here, you can set the
format via a chart template and IIRC, via a function in GPL. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU) I have data like
this ID Year Rate
The format for Rate
is F11.5. When I look at the
data in the data editor, it displays as above. When I run EXPLORE,
it output displays as above. However, when I try
to graph the data, the values on the Y axis are in Scientific Notation. Here's the syntax
that I'm using: GRAPH I get the same
result using GGRAPH. How can I get the
Y-axis to have the values 0 to .00370 rather than 0 to 4.00000E-3? TIA Pat |
| Free forum by Nabble | Edit this page |
