I'm want to create an XSchart
this is the code I used but the chart was split into 5 instead of 1. The dates in my data are 09/01/2020, 10/01/2020, 11/01/2020, and so on. Do I need to include something that will make just 1 chart?
title "Length of Stay";
symbol v=dot;
proc shewhart data=work.nowsbaseline_sorted;
xschart neonatald*measureperiodid;
run;
Try something like this
xschart neonatald*measureperiodid/haxis='01SEP2020'd to '01JUL2021'd by month;
You might also want to consider using a shorter format on the x-axis, for example assigning format YYMM5. to the x-axis variable, or using the TURNHLABELS option in PROC SHEWHART.
I tried that code but I got the same result.
Hello, @annaabimbola
From now on, when code isn't working, SHOW US THE LOG (and from now on, do not wait until we request to see the log). We need to see the ENTIRE log for your PROC SHEWHART, all of it, 100%, every character of the log for PROC SHEWHART. Do not pick and choose parts of the PROC SHEWHART log to show us.
IMPORTANT INSTRUCTIONS: copy the log as text, then paste it into the window that appears when you click on the </> icon. DO NOT SKIP THIS STEP.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 74 title "Length of Stay"; 75 symbol v=dot; 76 77 proc shewhart data=work.nowsbaseline_sorted; 78 xschart neonatald*measureperiodid/haxis='01SEP2020'd to'01JUL2021'd by month; 79 *xschart neonatald*measureperiodid; 80 run; NOTE: Processing beginning for XSCHART statement number 1. ERROR: HAXIS values must be uniformly spaced. WARNING: Default axis scaling will be used. NOTE: Three-sigma limits are assumed. NOTE: TYPE=ESTIMATE is assumed for the process mean and standard deviation used to compute the control limits. NOTE: Since the format MMDDYY is associated with the subgroup variable MeasurePeriodID, it is assumed that the natural interval between subgroup positions is one DAY. NOTE: The REPEAT option is assumed when a MMDDYY format is used with a subgroup variable. NOTE: There were 146 observations read from the data set WORK.NOWSBASELINE_SORTED. NOTE: PROCEDURE SHEWHART used (Total process time): real time 1.67 seconds user cpu time 0.79 seconds system cpu time 0.06 seconds memory 40867.59k OS Memory 71280.00k Timestamp 07/07/2021 08:46:54 PM Step Count 44 Switch Count 0 Page Faults 0 Page Reclaims 13755 Page Swaps 0 Voluntary Context Switches 1675 Involuntary Context Switches 3 Block Input Operations 0 Block Output Operations 5176 81 82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 94
ERROR: HAXIS values must be uniformly spaced.
Hmmm ... must be I mis-remembered that you can use months in PROC SHEWHART on the x-axis. It is kind of picky about things like that.
You can assign an integer index to each of your dates.
So, assign 01SEP2020 the index of 1, 01OCT2020 the index of 2, and so on. Then use this index as your horizontal axis variable. Also create a variable YEAR which contains 2020 and 2021, and a variable month which is 1 through 12 for each time period. Then
xschart neonatald*index (year month);
You can see examples here: https://documentation.sas.com/doc/en/qcug/15.2/qcug_shewhart_sect473.htm
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 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.