BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
narnia649
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@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.

 

narnia649_0-1600774231414.png

 


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

--
Paige Miller

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Why not make SAMPLE a datetime with unique values? And then format it as as a date when plotting using format dtdate, 

narnia649
Obsidian | Level 7

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_0-1600774231414.png

 

PaigeMiller
Diamond | Level 26

@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.

 

narnia649_0-1600774231414.png

 


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

--
Paige Miller

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
  • 3 replies
  • 470 views
  • 0 likes
  • 3 in conversation