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

Hi all,

 

I would like to plot graph as  below.

X-axis has 2 labels.

 

what's the command i should do?

 

proc sgplot data=tmp;
series x=rownum y=avg ;

 


xaxis label="X axis";

run;


ScreenHunter_133 Oct. 06 21.26.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

You probably want to combine the LABEL= option for the XAXIS statement with teh global FOOTNOTE statement.

Experiment with using the FOOTNOTE JUSTIFY= option to get what you want.

You might also need to move the legend around. Here's an example to get started:

footnote justify=center "X axis";
proc sgplot data=sashelp.class;
   vbar age / group=sex response=height stat=mean groupdisplay=cluster;
   xaxis label="(Time)" labelpos=right;
   keylegend / position=topleft location=inside;
run;

 

View solution in original post

3 REPLIES 3
Reeza
Super User

What version of SAS do you have? 

Have you looked at annotate? 

Rick_SAS
SAS Super FREQ

You probably want to combine the LABEL= option for the XAXIS statement with teh global FOOTNOTE statement.

Experiment with using the FOOTNOTE JUSTIFY= option to get what you want.

You might also need to move the legend around. Here's an example to get started:

footnote justify=center "X axis";
proc sgplot data=sashelp.class;
   vbar age / group=sex response=height stat=mean groupdisplay=cluster;
   xaxis label="(Time)" labelpos=right;
   keylegend / position=topleft location=inside;
run;

 

PGStats
Opal | Level 21

Here is how to do this with SG annotation:

 

data anno;
function="text";
drawspace="layoutpercent";
anchor="topright";
x1=100; y1=7;
label="Years";
run;

proc sgplot data=sashelp.class noautolegend sganno=anno;
vbar age / group=sex groupdisplay=cluster barwidth=0.8;
run;

SGPlot4.png

PG

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1158 views
  • 6 likes
  • 4 in conversation