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 🙂

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1346 views
  • 0 likes
  • 2 in conversation