BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
data_null__
Jade | Level 19

My tick labels are assigned with a format associated with the XAXIS variable.

 

 ----------------------------------------------------------------------------       
 |       FORMAT NAME: X22WEEK  LENGTH:    3   NUMBER OF VALUES:   18        |       
 |   MIN LENGTH:   1  MAX LENGTH:  40  DEFAULT LENGTH:   8  FUZZ: STD       |       
 |--------------------------------------------------------------------------|       
 |START           |END             |LABEL  (VER. V7|V8   04FEB2025:05:10:07)|       
 |----------------+----------------+----------------------------------------|       
 |             -26|             -26|S                                       |       
 |               1|               1|D1                                      |       
 |              15|              15|W2                                      |       
 |              29|              29|W4                                      |       
 |              45|              45|W6                                      |       
 |              57|              57|W8                                      |       
 |              85|              85|SAE                                     |       
 |             109|             109|W16                                     |       
 |             123|             123|W18                                     |       
 |             165|             165|W24                                     |       
 |             178|             178|W26                                     |       
 |             190|             190|W28                                     |       
 |             253|             253|W36                                     |       
 |             337|             337|W48                                     |       
 |             421|             421|W60                                     |       
 |             435|             435|W62                                     |       
 |             446|             446|W64                                     |       
 |             505|             505|W72                                     |       
 ----------------------------------------------------------------------------       

When the tick label is SAE I want it to be red and bold.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

John.King ,

Is this what you are looking for ?

 

proc sort data=sashelp.class
out =class;
by sex;
run;
proc format;
value fmt
11='W1'
12='W2'
13='W3'
14='SAE'
15='W5'
16='W6'
;
run;



%sganno
data sganno;
 %SGTEXT(LABEL="SAE",ID="BAR",TEXTWEIGHT="BOLD",TEXTCOLOR="RED",FILLCOLOR="white",FILLTRANSPARENCY=0,X1SPACE="DATAVALUE",Y1SPACE="LAYOUTPERCENT",X1=14,Y1=12.8 )
run;

proc template;
define statgraph mergedLegend;
begingraph;
entrytitle "Linear Regression By Gender";
layout overlay;
scatterplot x=age y=weight / group=sex name="scat";
regressionplot x=age y=weight/ group=sex name="reg";
mergedlegend "scat" "reg" / border=true;
annotate / id="BAR";
endlayout;
endgraph;
end;
proc sgrender data=class template=mergedLegend sganno=sganno;
format age fmt.;
run;

Ksharp_0-1738724408675.png

 

View solution in original post

1 REPLY 1
Ksharp
Super User

John.King ,

Is this what you are looking for ?

 

proc sort data=sashelp.class
out =class;
by sex;
run;
proc format;
value fmt
11='W1'
12='W2'
13='W3'
14='SAE'
15='W5'
16='W6'
;
run;



%sganno
data sganno;
 %SGTEXT(LABEL="SAE",ID="BAR",TEXTWEIGHT="BOLD",TEXTCOLOR="RED",FILLCOLOR="white",FILLTRANSPARENCY=0,X1SPACE="DATAVALUE",Y1SPACE="LAYOUTPERCENT",X1=14,Y1=12.8 )
run;

proc template;
define statgraph mergedLegend;
begingraph;
entrytitle "Linear Regression By Gender";
layout overlay;
scatterplot x=age y=weight / group=sex name="scat";
regressionplot x=age y=weight/ group=sex name="reg";
mergedlegend "scat" "reg" / border=true;
annotate / id="BAR";
endlayout;
endgraph;
end;
proc sgrender data=class template=mergedLegend sganno=sganno;
format age fmt.;
run;

Ksharp_0-1738724408675.png

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 227 views
  • 0 likes
  • 2 in conversation