I am trying to plot an end of work, that extends beyond a given time boundary. The typical day is 07:00 - 07:00 (wraps over midnight) So I would like to display the scatter 07:00-24:00, a break and then 00:00-06:59; The Date is on the Y axis and the end
Time is on the X axis. Ranges works, but reorders the ranges, so it displays 0:00-24:00, rather than 07:00-24:00 a break and then 00:00-6:59.
How can I force the order of the ranges?
Thank you.
proc sgplot data=xxxx;
STYLEATTRS datacontrastcolors =(pink red) datasymbols=(circlefilled);
SCATTER X=bTimeOut Y=bDateIn /group=bCaseType
;
yaxis display=(nolabel) REVERSE values=('Jan2019' 'Feb2019' 'Mar2019' 'Apr2019' 'May2019' 'Jun2019'
'Jul2019' 'Aug2019' 'Sep2019' 'Oct2019' 'Nov2019' 'Dec2019');
xaxis label='Last Case Ending (hr)' ranges=('07:00't - '24:00't '00:00't - '06:59't);
run;
Try using your normalized data time values, but get rid of the VALUES option and add the NOTIMESPLIT option, and the VALUESFORMAT option with a time format. Let me know if that works for you.
Could you please try the below range
ranges=('00:00't - '06:59't '07:00't - '24:00't)
No change.
I have changed the bTimeOut variable to a datetime. It correctly places the value, but now I hav 01Jan60 and 02Jan60 suffixes after the time value on the x axis. I have tried "format bTimeOut timeampm.;" but then it reverts to a time variable and increments above 24:00 28:00, 32:00 etc. Any more ideas?
Thank you.
Jagadishkatam, Thank you for your replies.
Here is where I am today. The closest I can get is with the following:
It does plot it correctly, but I since I "normalized" the datetime value to cover each day with a possible day+1 overlap, I get the dates printed.
If I add the following format to NewTimeDateData :
format NewTimeDateData timeampm8. ;
I get the following message:
NOTE: The column format TIMEAMPM8 is replaced by an auto-generated format on the axis.
and the output displays this:
If I create bTimeOut to timepart:
It combines the day0 values and day1 values. Not what I wanted
Here is the Code, Dataset Screenshot and resulting Plot. As you can see, it is incorrect. I wanted the times 0:00-6:00 to follow 24:00. They neve will with this method.
proc sgplot DATA=lastchance ;
format bTimeOutnew time. ;
SCATTER X=bTimeOutnew Y=Call_Date /group=bCaseType attrid=CaseType markerattrs=(symbol=circlefilled size =11);
yaxisdisplay=(nolabel)REVERSE
values=('Jan2019' 'Feb2019' 'Mar2019' 'Apr2019' 'May2019' 'Jun2019'
'Jul2019''Aug2019''Sep2019''Oct2019''Nov2019''Dec2019');
xaxis label='Last Case Ending (hr)' ;
Title "Call Cases Using TIME FORMATTED Value" ;
run;
Try the following:
proc sgplot data=lastchance NOAUTOLEGEND;
STYLEATTRS datacontrastcolors =(pink red) datasymbols=(circlefilled);
SCATTER X=NewTimeDateData Y=Call_Date /group=bCaseType ;
yaxis display=(nolabel)REVERSE
values=('Jan2019' 'Feb2019' 'Mar2019' 'Apr2019' 'May2019' 'Jun2019'
'Jul2019' 'Aug2019' 'Sep2019' 'Oct2019' 'Nov2019' 'Dec2019');
xaxis label='Last Case Ending (hr)' notimesplit value=time.;
Title "Ending Time of Last Case of Day" ;
run;
Try using your normalized data time values, but get rid of the VALUES option and add the NOTIMESPLIT option, and the VALUESFORMAT option with a time format. Let me know if that works for you.
Hi Dan,
Thank you very much!!! This worked! Here is the code I used and the resulting output:
proc sgplot DATA=lastchance ;
format NewTimeDateData OBStartTDdata timeampm8. ;
SCATTER X=NewTimeDateData Y=Call_Date /group=bCaseType attrid=CaseType markerattrs=(symbol=circlefilled size =11);
yaxisdisplay=(nolabel)REVERSE
values=('Jan2019' 'Feb2019' 'Mar2019' 'Apr2019' 'May2019' 'Jun2019'
'Jul2019''Aug2019''Sep2019''Oct2019''Nov2019''Dec2019');
xaxis label='Last Case Ending (hr)' VALUESFORMAT=TIMEAMPM8.;
Title "CALL CASES Using DateTime Value, Normalized to same day" ;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.