Hello,
I am plotting trends in odds ratio using proc sglot but the x-axis will not display all the years. I used "values" and "displayvalues" but they do not seem to work.
Please, kindly assist.
Thank you.
proc sgplot data=Females ;
format Health_cost_health_insur typeFmt.;
scatter y=Odds_ratio x=Year /group=Health_cost_health_insur yerrorlower=LL yerrorupper=UL markerattrs=(symbol=diamondfilled);
refline 0 / axis=y;
title 'Cherry-Picking Violation by Provider Designation';
xaxis grid
values=(2013 2014 2015 2016 2017 2018 2019)
Valuesdisplay=("2013" "2014" "2015" "2016" "2017" "2018" "2019" );;
yaxis grid discreteorder=data ;
xaxis display=ALL INTERVAL= Year;
keylegend / title="Health Coverage Status" location=outside;
title 'Trend in Health Coverage and Health Cost in Females Compared to Males';
xaxis label="Year";
yaxis label="Adjusted Odds Ratio";
run;
You have two XAXIS statements. When there are multiple axis statements affecting the same axis only the LAST one seems to be applied.
Combine the two into a single XAXIS and I think your problem will be fixed.
You really only the the VALUESDISPLAY to show something quite different than the formatted value. It might make sense if you were doing something like:
xaxis grid
values=(2013 2014 2015 2016 2017 2018 2019)
Valuesdisplay=("Baseline" "2014" "2015" "Intervention" "2017" "2018" "Evaluation" );
with something simple like year I would normally not bother with Valuesdisplay
You have two XAXIS statements. When there are multiple axis statements affecting the same axis only the LAST one seems to be applied.
Combine the two into a single XAXIS and I think your problem will be fixed.
You really only the the VALUESDISPLAY to show something quite different than the formatted value. It might make sense if you were doing something like:
xaxis grid
values=(2013 2014 2015 2016 2017 2018 2019)
Valuesdisplay=("Baseline" "2014" "2015" "Intervention" "2017" "2018" "Evaluation" );
with something simple like year I would normally not bother with Valuesdisplay
Thank you so much! I am most grateful.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.