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.
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;
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.