BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bruce123
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

2 REPLIES 2
ballardw
Super User

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")

Bruce123
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 941 views
  • 0 likes
  • 2 in conversation