BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
UcheOkoro
Lapis Lazuli | Level 10

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.

UcheOkoro_0-1649432640115.png

 

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;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

View solution in original post

2 REPLIES 2
ballardw
Super User

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

UcheOkoro
Lapis Lazuli | Level 10

Thank you so much! I am most grateful.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 757 views
  • 0 likes
  • 2 in conversation