Hello,
Question:
How can I use one subgroup variable in PROC Shewhart but later display a different variable as the x-axis label?
For example:
PROC SHEWHART data=my_data;
irchart measure*sample / href=sample_no;
RUN;
But then rewrite the x-axis to use the date instead of the sample.
Background:
The x-axis are date formats and sometimes are repeats of one another.
Because of this, I get a lot of warning messages even though they are not the same, but simply occurred on the same date.
In addition, if I attempt to display href lines they repeat because potentially two data points have the same date value.
I would like to create a new variable that increments so there are no repeats, but then override the x-axis to display the original dates.
Thank you in advance for your help!
@narnia649 wrote:
I got the datetime to work, but couldn't format it without having issues with the interval & exceeding max panels.
DATA my_process; INPUT x1 $ x2 $ x3 $ x4 group time datetime13.; FORMAT time datetime13.; DATALINES; a a a 1 1 01JAN60:04:53 a a a 2 1 01JAN60:05:53 a a a 1 1 04JAN60:04:53 a a a 3 1 05JAN60:05:53 ; RUN; PROC SHEWHART DATA = my_process; BY x1 x2 x3; IRCHART x4*time / turnhlabels INTERVAL=DTDAY; RUN;
Unfortunately, it is doing what I didn't want to do with the scaling. Instead of showing a single space between dates it shows the true scale.
Your data is unequally spaced in time, you might want to instead just create a sequence number and plot the sequence number on the x-axis, this ought to eliminate the problems you mentioned. If you absolutely have to have some indication on month and day in the plot, then you can use the ability of PROC SHEWHART to add the day and month information elsewhere as a BLOCK variable, as shown in this example https://documentation.sas.com/?docsetId=qcug&docsetTarget=qcug_shewhart_sect473.htm&docsetVersion=15...
Why not make SAMPLE a datetime with unique values? And then format it as as a date when plotting using format dtdate,
I got the datetime to work, but couldn't format it without having issues with the interval & exceeding max panels.
DATA my_process;
INPUT x1 $ x2 $ x3 $ x4 group time datetime13.;
FORMAT time datetime13.;
DATALINES;
a a a 1 1 01JAN60:04:53
a a a 2 1 01JAN60:05:53
a a a 1 1 04JAN60:04:53
a a a 3 1 05JAN60:05:53
;
RUN;
PROC SHEWHART DATA = my_process; BY x1 x2 x3;
IRCHART x4*time / turnhlabels INTERVAL=DTDAY;
RUN;
Unfortunately, it is doing what I didn't want to do with the scaling. Instead of showing a single space between dates it shows the true scale.
@narnia649 wrote:
I got the datetime to work, but couldn't format it without having issues with the interval & exceeding max panels.
DATA my_process; INPUT x1 $ x2 $ x3 $ x4 group time datetime13.; FORMAT time datetime13.; DATALINES; a a a 1 1 01JAN60:04:53 a a a 2 1 01JAN60:05:53 a a a 1 1 04JAN60:04:53 a a a 3 1 05JAN60:05:53 ; RUN; PROC SHEWHART DATA = my_process; BY x1 x2 x3; IRCHART x4*time / turnhlabels INTERVAL=DTDAY; RUN;
Unfortunately, it is doing what I didn't want to do with the scaling. Instead of showing a single space between dates it shows the true scale.
Your data is unequally spaced in time, you might want to instead just create a sequence number and plot the sequence number on the x-axis, this ought to eliminate the problems you mentioned. If you absolutely have to have some indication on month and day in the plot, then you can use the ability of PROC SHEWHART to add the day and month information elsewhere as a BLOCK variable, as shown in this example https://documentation.sas.com/?docsetId=qcug&docsetTarget=qcug_shewhart_sect473.htm&docsetVersion=15...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: