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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2 replies
  • 319 views
  • 0 likes
  • 2 in conversation