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.

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