Data visualization with SAS programming

Basis Proc Gplot help

Accepted Solution Solved
Reply
Contributor
Posts: 47
Accepted Solution

Basis Proc Gplot help

Hello

I am quite new to Sas so I am having some trouble with what I assume i some basis Gplot.

I am trying to do two things.

1) I wish to added a colour around the max and minimum value on Y-akse. Preferable two different colours. So that you around the frame ofthe maksimum and minimum value can see that this is the limit that the graph can go up or down.

2) I wish that the graph shows the value of the last observeration besides the point of the graph, so you easily can read its value.

My code is as follows:

PROC SORT

  DATA=Have

  OUT=A ;

  BY Date;

  RUN;

  SYMBOL1 INTERPOL=JOIN HEIGHT=10pt VALUE=NONE LINE=1 WIDTH=3 CV = 'Green';

  Axis1 STYLE=1 WIDTH=1 MINOR=NONE LABEL=( FONT="Verdana /b"  ANGLE=90 "ABC") VALUE=(FONT="Verdana" );

  Axis2 STYLE=1 WIDTH=1 MINOR=NONE LABEL=( FONT="Verdana /b"   "Date" JUSTIFY=RIGHT) VALUE=(FONT="Verdana" ANGLE=45 ) ;

  TITLE;

  TITLE1 "ABC";

  FOOTNOTE;

  PROC GPLOT DATA = Have;

  PLOT A*B  / VAXIS=-10 to 10 by 2 VREF=-10 VREF=10 HAXIS=AXIS2 FRAME LVREF=1 CVREF=BLACK AUTOVREF;

  FORMAT B DTDATE9.;

  RUN; QUIT;

  TITLE; FOOTNOTE;

  GOPTIONS RESET = SYMBOL;

  quit;run;

All help will be greatly appreciated

Best Regards

Bruce


Accepted Solutions
Solution
‎04-24-2014 12:48 PM
Grand Advisor
Posts: 9,748

Re: Basis Proc Gplot help

The Value option in the Axis statement is used to modify the appearance of tick mark labels. However it recognizes ordinal position of the tickmark the first value option going to the first tick, second value option going to second tick mark and so forth, use the TICK suboption to specify options for specific marks. Your Vaxis= would have to be modified to reference another axis statement which would include an order= ( -10 to 10 by 2 ) option.

Value = ( tick=1 color = red "-10"

               tick=1 color = blue "10")

shoud assign red and blue to the min and max value of the axis. you can change the display text to "Max 10" or similar as well as adjusting a variety of options. Look at the documentation for AXIS for more details. HINT: Text options appear before the value modified AND in some uses will persist to following elements so you may need to reset back to defaults.

To display the value of the markers use the pointlabel option in a Symbol statement. If you only want to mark one point it gets more challenging. The easiest may be to add a second variable containing the value you want displayed only for that value of x and use the Pointlabel option to point to that variable:

pointlabel = ("#yvaluelabelvariable")

View solution in original post


All Replies
Solution
‎04-24-2014 12:48 PM
Grand Advisor
Posts: 9,748

Re: Basis Proc Gplot help

The Value option in the Axis statement is used to modify the appearance of tick mark labels. However it recognizes ordinal position of the tickmark the first value option going to the first tick, second value option going to second tick mark and so forth, use the TICK suboption to specify options for specific marks. Your Vaxis= would have to be modified to reference another axis statement which would include an order= ( -10 to 10 by 2 ) option.

Value = ( tick=1 color = red "-10"

               tick=1 color = blue "10")

shoud assign red and blue to the min and max value of the axis. you can change the display text to "Max 10" or similar as well as adjusting a variety of options. Look at the documentation for AXIS for more details. HINT: Text options appear before the value modified AND in some uses will persist to following elements so you may need to reset back to defaults.

To display the value of the markers use the pointlabel option in a Symbol statement. If you only want to mark one point it gets more challenging. The easiest may be to add a second variable containing the value you want displayed only for that value of x and use the Pointlabel option to point to that variable:

pointlabel = ("#yvaluelabelvariable")

Contributor
Posts: 47

Re: Basis Proc Gplot help

Hey

Thanks for your reply and help.

It solved my problem.

I got the mark on the last point by creating another variable with only that observation and it did the job Smiley Happy

Have a nice day

Post a Question
Discussion Stats
  • 2 replies
  • 330 views
  • 0 likes
  • 2 in conversation