Data visualization with SAS programming

Plotting time series with date and time

Reply
New Contributor
Posts: 2

Plotting time series with date and time

[ Edited ]

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. 

 

Attachment
Grand Advisor
Posts: 10,210

Re: Plotting time series with date and time

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.

Ask a Question
Discussion stats
  • 1 reply
  • 250 views
  • 0 likes
  • 2 in conversation