BookmarkSubscribeRSS Feed
breana_murphy
Calcite | Level 5

Hi,

 

I am trying to create a time series plot that includes dates and hours. I want to show the trend by hour and by date. 

 

Currently I have used proce template with data lattice to do this:

 

proc template;
define statgraph Day_Hour;
begingraph;
layout gridded / border=false ;
layout datalattice columnvar=date / headerlabeldisplay=value border=false columnheaders=bottom columnaxisopts=(label="Date" )
cellwidthmin=10 cellheightmin=10
;

layout prototype /walldisplay=(fill) ;
seriesplot x=hour y=count /display=(markers) break=false markerattrs=graphdata1(symbol=circlefilled size=9)
lineattrs=graphdata1;
endlayout;
endlayout;
endlayout;
endgraph;
end;
run;

 

 

Hwoever, I want the trend line to connect across days and with data lattice it breaks between each day. I want the last hour of September 29th to connect with the first hour of Sepetmber 28th.

 

Do you know how I can get my trend line to connect, but still show dates and hours. 

 


Timeseries with date and time.PNG
1 REPLY 1
ballardw
Super User

Do you really want " I want the last hour of September 29th to connect with the first hour of Sepetmber 28th."

Did you mean " I want the last hour of September 28th to connect with the first hour of Sepetmber 29th."?

 

For continuous plots involving date and time I would ensure that I had a SAS date time variable.

 

You could make a datetime variably using the DHMS function:

DT = DHMS(date, hour,0,0);

in a data step.

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
  • 1 reply
  • 2025 views
  • 0 likes
  • 2 in conversation