BookmarkSubscribeRSS Feed
acegsm
Obsidian | Level 7

Good afternoon,

 

I have a plot with start times and end times, e.g. 23:00 start time in red and 04:00 end time in blue, so the end time actually occurs before the start time on the plot. I would like to connect these points, which I have done, but I would like them to connect by wrapping around.

 

E.G.

00:00:00---------------------END                            START--------------------------23:59:59                               SHIFT1

00:00:00                                                    START--------------------------------------END                                SHIFT 2

 

I am currently using sgplot and SAS 9.4. Any suggestions?

 

Thank you.

 

3 REPLIES 3
Reeza
Super User

Add a date component, so it's a date time variable and then graph it using a SERIES statement.

 

Wait...what do you mean by wrapping around?

acegsm
Obsidian | Level 7

Hi Reeza,

 

I have the dates; however, I would like the start times to line up. So, if I have a start time of 13:00 on day 1 and a start time of 14:00 on day 2 then day 2's start time is below day 1 and slightly to the right. I currently the plots organized this way; however, I would like to connect the points. 

 

So, if I have a start time of 14:00 and an end time of 20:00 then it is no problem. The points are connected in the correct fashion. However, if I have a start time of 14:00 and an end time of 02:00 then I would want the line to go off towards the ride and continue on the same line.

 

The plots are organized from 00:00:00 to 23:59:59 on the x-axis and by day # on the y-axis.

Reeza
Super User

I think you'll have to add some fake data somehow.

 

So if it crosses the 'boundary' then you split the point to represent the two portions:

 

22:00h to 02:00h becomes:

 

0:00 to 02:00h

22:00 to 0:00h

 

If you post better fake data and a picture of what you want your graph to look like you might get some code 🙂

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 797 views
  • 0 likes
  • 2 in conversation