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

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 739 views
  • 0 likes
  • 2 in conversation