BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
bhr-q
Pyrite | Level 9

Hi everyone,

I can see all the markers in the plot, but the corresponding admission dates on the x-axis are not fully visible. How can I adjust to see every admission date?

 

proc shewhart data=VV;
xchart   LOS*admission_date  /Markers   outtable=outtable    nohlabel   TOTPANELS=1;
run;proc print;run;

 

Thanks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Zard
SAS Employee
If you split dates up into Year, Month, and Day and use Day as the group var while blocking on Year and Month, it can help to fit more labels. Such as:
data vv ;
  format admission_date date9.;
  do admission_date='05Mar2023'd to '15Mar2024'd;
    do i=1 to 5;
      los=10+3*rand('normal');
      output ;
    end ;
  end ;
  drop i;
run ;
proc shewhart data=VV;
  Xchart LOS*admission_date /Markers totpanels=1;
run;

Zard_0-1715358985921.png

data vv;
  set vv;
  year=year(admission_date);
  month=month(admission_date);
  day=day(admission_date);
  charday=put(day,2.); *use a character subgroup var, otherwise DAY is required to be sorted;
run;
proc shewhart data=VV;
  Xchart LOS*charday(month year) /Markers totpanels=5;
run;
(showing 1st of 5 panels)

Zard_2-1715359105097.png

 

 

View solution in original post

7 REPLIES 7
Quentin
Super User

Are you getting a note in the log saying some of your tick value labels were "thinned"?  If there are too many tick labels SAS will typically try to rotate them, but after that will thin them so they don't collide.  You could maybe try shrinking the font (probably in style template), if you're close to fitting.  But typically I just live with the thinning, and perhaps add minor tick marks in between the labeled major tick marks. 

 

In the off chance that you're using HTML output, you can add "tips" to each marker, where a user can hove over a marker and it will show you the x-value.

bhr-q
Pyrite | Level 9

Thank you for your answer; Log is usual, and I don’t get a note in the log saying some of the tick value labels were too "thinned."

There are not too many tick labels. I can see just 11 out of 23.

 

I tried this way but still showed me the 11 label

proc shewhart data=VV;

   Xchart LOS*admission_date /Markers outtable=outtable nohlabel  TOTPANELS=1  Hminor=23 ;

run;proc print;run;

Quentin
Super User

I guess SHEWHART is silently thinning.  The docs for HAXIS option say:

Quentin_0-1715353752782.png

You could try adding TURNHLABELS, and see if you get lucky, e.g.:

data vv ;
  do admission_date=1 to 30 ;
    do los=10 to 30 by 10 ;
      output ;
    end ;
  end ;
run ;
proc shewhart data=VV;
   Xchart LOS*admission_date /Markers turnhlabels haxis=1 to 30 by 1;
run;

 

 

ballardw
Super User

From discussion in  https://communities.sas.com/t5/Statistical-Procedures/Adding-reference-line-in-p-chart/m-p/927782#M4... it appeared that @bhr-q does not have SAS/Graph.

 

Which means that HAXIS= <anything> is likely not going to work as that looks like SAS/Graph syntax.

 

Might try using ODS GRAPHICS / width= 10in; (or similar) option to make the graph larger which might allow more ticks and labels to display. At least it is quick to test.

 

bhr-q
Pyrite | Level 9
Thank you for your answer, I tried this way just made my plot wider.
bhr-q
Pyrite | Level 9
I could get the answer with this way as well. Thank you for your help.
Zard
SAS Employee
If you split dates up into Year, Month, and Day and use Day as the group var while blocking on Year and Month, it can help to fit more labels. Such as:
data vv ;
  format admission_date date9.;
  do admission_date='05Mar2023'd to '15Mar2024'd;
    do i=1 to 5;
      los=10+3*rand('normal');
      output ;
    end ;
  end ;
  drop i;
run ;
proc shewhart data=VV;
  Xchart LOS*admission_date /Markers totpanels=1;
run;

Zard_0-1715358985921.png

data vv;
  set vv;
  year=year(admission_date);
  month=month(admission_date);
  day=day(admission_date);
  charday=put(day,2.); *use a character subgroup var, otherwise DAY is required to be sorted;
run;
proc shewhart data=VV;
  Xchart LOS*charday(month year) /Markers totpanels=5;
run;
(showing 1st of 5 panels)

Zard_2-1715359105097.png

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 2059 views
  • 6 likes
  • 4 in conversation