BookmarkSubscribeRSS Feed
uopsouthpaw
Calcite | Level 5

Is there a way to change the yaxis labeling instead of a numerical range (in this case 0-1) into showing a text label (see picture below.  I manually pasted the output I wanted on top of the yaxis as an example.  Aka, remove number value and replace with text equivalent)?

 

I'm trying to create an overlaid vbar chart that tracks the progress of corrective actions.  I'm taking 2 date cuts to see what progression toward closure has been made.  I assigned each progression "state" a numerical value (completeness).  However, through searching here and on the web, I haven't found a good way to graph it.  I can't assign a format to a numerical response (needed for vbar and vbarparm).  

 

***Example Data set and output

Data A1;
input ID X1_Pct X2_Pct;
datalines;
1 0.1 0.1
2 0.95 1.0
3 0.75 0.5
4 0.1 0.25
5 0.5 0.5
6 0.5 0.75
;
run;

proc format;
value A1_fmt
0.1 = "Opened"
0.25 = "Investigation"
0.5 = "Stage 3"
0.75 = "Stage 4"
0.95 = "Pending Review"
1.00 = "Closed";
run;
Proc sgplot data=A1;
Title "Action Item: C1 C2 Overlay";
styleattrs datacolors=(Gray BIOY);
vbar ID / response=X2_PCT;
vbar ID / response=X1_PCT barwidth=.4 transparency=.5 nooutline ;
xaxis fitpolicy=rotatethin;
run;

uopsouthpaw_1-1707867046700.png

I swear the answer is probably so simple, but I'm not sure how to properly phrase the question on the internet to get the right answer.

 

Thanks,

Wes

 

3 REPLIES 3
uopsouthpaw
Calcite | Level 5
I'm even fine with throwing the text over on the y2 axis. but I wasn't able to figure out the yaxistable statement. I'm assuming it has to do with the numerical value issue I'm having anyway.
ballardw
Super User

Is this what you want?

Proc sgplot data=A1;
Title "Action Item: C1 C2 Overlay";
styleattrs datacolors=(Gray BIOY);
vbar ID / response=X2_PCT;
vbar ID / response=X1_PCT barwidth=.4 transparency=.5 nooutline ;
xaxis fitpolicy=rotatethin;
yaxis values=(0.1 0.25 0.5 0.75 0.95 1.0)  valuesformat=A1_fmt.;
run;

You didn't provide anything that would change the default tick mark generation of equal spaced ticks and nothing to apply the format.

 

Note that using actual character values gets you into a some more complex approaches to managing your data and getting the order on the axis correct and character values have NO natural spacing interval. They would have the same spacing between ticks pretty much regardless what you try.

 


@uopsouthpaw wrote:

Is there a way to change the yaxis labeling instead of a numerical range (in this case 0-1) into showing a text label (see picture below.  I manually pasted the output I wanted on top of the yaxis as an example.  Aka, remove number value and replace with text equivalent)?

 

I'm trying to create an overlaid vbar chart that tracks the progress of corrective actions.  I'm taking 2 date cuts to see what progression toward closure has been made.  I assigned each progression "state" a numerical value (completeness).  However, through searching here and on the web, I haven't found a good way to graph it.  I can't assign a format to a numerical response (needed for vbar and vbarparm).  

 

***Example Data set and output

Data A1;
input ID X1_Pct X2_Pct;
datalines;
1 0.1 0.1
2 0.95 1.0
3 0.75 0.5
4 0.1 0.25
5 0.5 0.5
6 0.5 0.75
;
run;

proc format;
value A1_fmt
0.1 = "Opened"
0.25 = "Investigation"
0.5 = "Stage 3"
0.75 = "Stage 4"
0.95 = "Pending Review"
1.00 = "Closed";
run;
Proc sgplot data=A1;
Title "Action Item: C1 C2 Overlay";
styleattrs datacolors=(Gray BIOY);
vbar ID / response=X2_PCT;
vbar ID / response=X1_PCT barwidth=.4 transparency=.5 nooutline ;
xaxis fitpolicy=rotatethin;
run;

uopsouthpaw_1-1707867046700.png

I swear the answer is probably so simple, but I'm not sure how to properly phrase the question on the internet to get the right answer.

 

Thanks,

Wes

 


 

uopsouthpaw
Calcite | Level 5

That is perfect.  I knew it was just a slight alteration to the axis but couldn't for the life of me find the right set of commands.

 

Thank you so much.

 

Wes

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 314 views
  • 0 likes
  • 2 in conversation