Remove decimals from axis with syntax

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Remove decimals from axis with syntax

ChrisKeran
I am creating a line graph (see syntax below) and would like to have no
decimals on the Y axis. I know I can edit the graph after it is created, but
is there a way to remove the decimals with syntax?
FYI, I'm using v26 on Windows 10.


* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Month[LEVEL=ORDINAL] PLT(Q1,
2)[name="PLT_Q1_2"]
    CommentYes MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Month=col(source(s), name("Month"), unit.category())
  DATA: PLT_Q1_2=col(source(s), name("PLT_Q1_2"))
  DATA: CommentYes=col(source(s), name("CommentYes"), unit.category())
  GUIDE: axis(dim(1), label("Month"))
  GUIDE: axis(dim(2), label("% Yes"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("CommentYes"))
  SCALE: cat(dim(1), include("8", "10"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1"))
  ELEMENT: line(position(Month*PLT_Q1_2), color.interior(CommentYes),
missing.wings())
END GPL.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Remove decimals from axis with syntax

Robert L
Try changing the number of decimals for the actual variable. The primitive way as I see it would be in the Variable View or better in Data/Define Variable Properties. Or directly in syntax with FORMATS (...) of course.

Robert

-----Ursprungligt meddelande-----
Från: SPSSX(r) Discussion [mailto:[hidden email]] För ChrisKeran
Skickat: den 5 november 2019 15:19
Till: [hidden email]
Ämne: Remove decimals from axis with syntax

I am creating a line graph (see syntax below) and would like to have no decimals on the Y axis. I know I can edit the graph after it is created, but is there a way to remove the decimals with syntax?
FYI, I'm using v26 on Windows 10.


* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Month[LEVEL=ORDINAL] PLT(Q1, 2)[name="PLT_Q1_2"]
    CommentYes MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Month=col(source(s), name("Month"), unit.category())
  DATA: PLT_Q1_2=col(source(s), name("PLT_Q1_2"))
  DATA: CommentYes=col(source(s), name("CommentYes"), unit.category())
  GUIDE: axis(dim(1), label("Month"))
  GUIDE: axis(dim(2), label("% Yes"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("CommentYes"))
  SCALE: cat(dim(1), include("8", "10"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.interior), include("0", "1"))
  ELEMENT: line(position(Month*PLT_Q1_2), color.interior(CommentYes),
missing.wings())
END GPL.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Robert Lundqvist
Reply | Threaded
Open this post in threaded view
|

Re: Remove decimals from axis with syntax

ChrisKeran
Thank you, Robert, however, I had already tried Alter Type Q1(F1.0), without
success, and just now tried Formats Q1(F1.0), without success.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Remove decimals from axis with syntax

Jon Peck
The chart should automatically pick up the decimals setting of the relevant variables, but you can also use a chart template set to zero decimals.  I'll send you one separately from the list.

Here's example syntax.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
   TEMPLATE=["C:\spss26\Looks\zerodecimals.sgt"]
  /FITLINE TOTAL=NO.
...

On Tue, Nov 5, 2019 at 7:28 AM ChrisKeran <[hidden email]> wrote:
Thank you, Robert, however, I had already tried Alter Type Q1(F1.0), without
success, and just now tried Formats Q1(F1.0), without success.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Remove decimals from axis with syntax

ChrisKeran
That .sgt command and file worked great, Jon, thank you.
FYI, it removed the % symbol too, but that's ok.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Remove decimals from axis with syntax

Jon Peck
If you want to keep the %, create a chart without the template, edit it, and save a new one picking only the scale axis format for the template.

On Tue, Nov 5, 2019 at 7:57 AM ChrisKeran <[hidden email]> wrote:
That .sgt command and file worked great, Jon, thank you.
FYI, it removed the % symbol too, but that's ok.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD